web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Easiest way to pass multiple values back.

(0) ShareShare
ReportReport
Posted on by 535

So I have an external C# class project that I consume a soap connection and get 3 pieces of data back. Which I would like to pass back from the call I make in the class in X code. Below I was the boolean that I get back from the call and the coopfunds and amffunds that return a decimal number.

 public void GetBillToInfo(str Billto)
    {
        ExternalWebServices.GetBDFFund GetBDFFund = new ExternalWebServices.GetBDFFund();

        real CoopFunds = 0;
        real AMFFunds = 0;
        String50 errorMsg;

        var fund = "";
       
        var tempFund = GetBDFFund.GetMichelinFunds(Billto, CoopFunds, AMFFunds, errorMsg);
       
        return tempFund;

    }

I have the same question (0)
  • Martin Dráb Profile Picture
    238,745 Most Valuable Professional on at

    The usual way in object-oriented programming is creating an object with three values and returning this object.

  • KeithM Profile Picture
    535 on at

    My issue is getting the right  type between the C# class project and the d365 X type.  I am trying to use an array, but since its a system type and x is not is not complying.


    Error Cannot implicitly convert from type 'System.String[' to type 'str['. 

    pastedimage1676559802366v1.png

    c# class object

           public string[] GetMichelinFunds(String billto, decimal CoopFunds, decimal AMFFunds, string strError)
            {
                BasicHttpBinding httpBinding = new BasicHttpBinding();
                EndpointAddress endPoint = new EndpointAddress(@"http://xxx.channel-fusion.com/asmx/FundByDealerNumber.asmx");
    
                string[] michelinInfo = new string[3];
    
                var soapClient = new FundByDealerNumberSoapClient(httpBinding, endPoint);
                michelinInfo[0] = soapClient.AvailableFunds(billto, ref CoopFunds, ref AMFFunds, ref strError, pass).ToString();
                
                michelinInfo[1] = CoopFunds.ToString();
                michelinInfo[2] = AMFFunds.ToString();
    
                soapClient.Close();
    
                return michelinInfo;
    
            }

    x method:

        public void GetBillToInfo(str Billto)
        {
            ExternalWebServices.GetBDFFund GetBDFFund = new ExternalWebServices.GetBDFFund();
    
            real CoopFunds = 0;
            real AMFFunds = 0;
            String50 errorMsg;
    
            String30  michelinInfo[];
    
            michelinInfo = GetBDFFund.GetMichelinFunds(Billto, CoopFunds, AMFFunds, errorMsg);
                    
        }

  • Verified answer
    Martin Dráb Profile Picture
    238,745 Most Valuable Professional on at

    You seem to making a set of artificial problem. Using a class is much easier.

    For example:

    public MichelinInfo GetMichelinFunds(String billto)
    {
    	BasicHttpBinding httpBinding = new BasicHttpBinding();
    	EndpointAddress endPoint = new EndpointAddress(@"http://xxx.channel-fusion.com/asmx/FundByDealerNumber.asmx");
    	var soapClient = new FundByDealerNumberSoapClient(httpBinding, endPoint);
    	MichelinInfo data = new MichelinInfo();
    	
    	try
    	{
    		decimal coopFunds = 0;
    		decimal amfFunds = 0;
    		str strError = '';
    		
    		data.Success = soapClient.AvailableFunds(billto, ref coopFunds, ref amfFunds, ref strError, pass);
    		data.CoopFunds = coopFunds;
    		data.AMFFunds = amfFunds;
    	}
    	finally
    	{
    		if (soapClient)
    		{
    			soapClient.Close();
    		}
    	}
    
    	return data;
    }

    Usage from X :

    public void getBillToInfo(str _billto)
    {
    	ExternalWebServices.GetBDFFund getBDFFund = new ExternalWebServices.GetBDFFund();
    	ExternalWebServices.MichelinInfo michelinInfo = getBDFFund.GetMichelinFunds(_billto);
    	
    	real coopFunds = michelinInfo.CoopFunds;
    	real amfFunds = michelinInfo.AMFFunfs;
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 545 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 408

#3
Adis Profile Picture

Adis 267 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans