• krishna 2619
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies
public class NumbringOrdAPI{
<br>
@auraEnabled<br>
public static string OrderApi(string ordId){<br>

  // Get Endpoint Sid 
  EndPointSid = NumberServerAPI.GetServerName(config.Server__c,authorizationHeader,metadata.Server_API_URL__c,metadata.Server_API_Method__c); <br>
<br> 
  TenentId= CallswitchTenantsAPI.getTenents(config.Tenant_ID__c,config.Server__c,authorization,metadata.Callswitch_Tenant_URL__c,metadata.Callswitch_Tenant_Method__c); 
<br>
<br>  
   if(TenentId != null && TenentId != 'Unable to Authorize to CallSwith Server' && TenentId !='Unable to find Tenent code in the server'){<br>

    flowCheck = 'End Point Sid fetched Sucessfully';<br>
   for(NumberingOrder__c numOrd : ordlst){<br>
        String jsonS = 'sid='+numOrd.Area_code_for_API__c+'&quantity='+numOrd.HowManyNumbers__c;<br>
        Http httpprotocal=new Http();<br>
        HttpRequest request=new HttpRequest();<br>
        request.setEndpoint(metadata.Order_API_URL__c);<br>           
        request.setMethod(metadata.Order_API_Method__c);<br>
        request.setHeader('Authorization','Basic '+authorizationHeader);<br>
        request.setHeader('Accept','application/json');<br>
        request.setHeader('Content-Type','application/x-www-form-urlencoded');<br>
        request.setTimeout(120000);  <br>
        request.setBody(jsonS);<br>
        system.debug('---URL----'+metadata.Order_API_URL__c);<br>
        system.debug('---Mothod----'+metadata.Order_API_Method__c);<br>
        system.debug('-------'+authorizationHeader); <br>
        system.debug('----jsonSjsonS---'+jsonS); <br>
        HttpResponse response = httpprotocal.send(request);<br>
        system.debug('Response deforder it is sent to site'+response);<br>
        System.debug('Returned result is'+response.getBody());<br>
        string res=response.getBody();<br>
         res = res.replaceFirst('number','numbers');<br>
        if(response.getStatuscode()==200 || response.getStatuscode()==201 )<br>
          {<br>
            list<NumberOrders> resobj = (list<NumberOrders>)JSON.deserialize(res,list<NumberOrders>.class);  <br>       
            system.debug('resp1 '+resobj );<br>
            if(resobj != null)<br>
            {<br>
            <br><br>
               setnumberSid = NumberServerAPI.assginedNumbers(numOrd.Area_code_for_API__c,resobj[0].sid,authorizationHeader,metadata.SetNumberURL__c,metadata.SetNumber_Mthod__c);<br>
                 <br>
               AddressSid = ZironAddressApi.PostAddress(numOrd,authorizationHeader,metadata.Installation_Address_URL__c,metadata.Installation_Address_Method__c);
                <br>
               if(resobj[0].sid != null && AddressSid != 'Error is adding Address to Ziron API')<br>
                 putAddress = ZironAddressApi.PutAddress(numOrd.sid__c,authorizationHeader,metadata.Address_to_Number_URL__c,metadata.Address_to_Number_Method__c);<br>
                else<br>
                break;<br>
            }    
        }    
     }
    } 
   }
 

This class is called from the button 

 

Below is the Json response which am getting .I was able to get "tenantcode" code but based on Tenent code I need string value

Example : if I loop map with string "204" I need 10 value s Output 

string str = '{"10":{"name":"IP Auth","tenantcode":"204"},"11":{"name":"Registration","tenantcode":"205"},"13":{"name":"API Demo","tenantcode":"206"},"2":{"name":" Test","tenantcode":"200"},"29":{"name":"testing 2","tenantcode":"207"},"3":{"name":"Training ","tenantcode":"201"},"30":{"name":" Test222","tenantcode":"208"},"31":{"name":"Martin","tenantcode":"212"},"32":{"name":"API Demo Customer","tenantcode":"209"},"4":{"name":"Adrian ","tenantcode":"202"},"9":{"name":"Stephen","tenantcode":"203"}}';
  Map<String, Object> resultsMap = (Map<String, Object>) JSON.deserializeUntyped(str);
    for(object obj : resultsMap.values()){
         Map<String,Object> data = (Map<String,Object>)obj;
          system.debug('utlevel30description---'+(String)data.get('tenantcode'));
      }
 

Hi All,

I wanted to roll up the 2 text fields of a child object into parent object how to that 
Example :   Value 1 + '  ' +  Quality 1;
                   Value 2  + '  ' + Quality 2
                  Value  3 + '  ' +   Quality 3
I wnated to rollup this  vlaues to the parent obejct 

Hi all I have created a Visualforce page chart but in this, i have 2 issues 

1) On top of the first bar its showing "0"
2) colors are not displayed in Leged properly 

Code : 
 <apex:chart data="{!data1}" height="400" width="500">
    <apex:legend position="left" />
    <apex:axis type="Numeric" position="left" title="Forecast" grid="true" fields="data1,data2,data3"  dashSize="2" minimum="0" maximum="200">
        <apex:chartLabel display="none" />
    </apex:axis>
    <apex:axis type="Category" position="bottom" fields="name" title="Q2" minimum="0" maximum="200">
        <apex:chartLabel display="none" rotate="315"/>
    </apex:axis>
    <apex:barSeries orientation="vertical" axis="left" stacked="true" xField="name" yField="Actual,Forcast,Planned" colorsProgressWithinSeries="True" colorSet="blue,Magenta,Yellow,LightSeaGreen" >
                <apex:chartLabel />

</apex:barSeries>
</apex:chart>  ​

User-added image

Below is the Json response which am getting .I was able to get "tenantcode" code but based on Tenent code I need string value

Example : if I loop map with string "204" I need 10 value s Output 

string str = '{"10":{"name":"IP Auth","tenantcode":"204"},"11":{"name":"Registration","tenantcode":"205"},"13":{"name":"API Demo","tenantcode":"206"},"2":{"name":" Test","tenantcode":"200"},"29":{"name":"testing 2","tenantcode":"207"},"3":{"name":"Training ","tenantcode":"201"},"30":{"name":" Test222","tenantcode":"208"},"31":{"name":"Martin","tenantcode":"212"},"32":{"name":"API Demo Customer","tenantcode":"209"},"4":{"name":"Adrian ","tenantcode":"202"},"9":{"name":"Stephen","tenantcode":"203"}}';
  Map<String, Object> resultsMap = (Map<String, Object>) JSON.deserializeUntyped(str);
    for(object obj : resultsMap.values()){
         Map<String,Object> data = (Map<String,Object>)obj;
          system.debug('utlevel30description---'+(String)data.get('tenantcode'));
      }
 

Hi all I have created a Visualforce page chart but in this, i have 2 issues 

1) On top of the first bar its showing "0"
2) colors are not displayed in Leged properly 

Code : 
 <apex:chart data="{!data1}" height="400" width="500">
    <apex:legend position="left" />
    <apex:axis type="Numeric" position="left" title="Forecast" grid="true" fields="data1,data2,data3"  dashSize="2" minimum="0" maximum="200">
        <apex:chartLabel display="none" />
    </apex:axis>
    <apex:axis type="Category" position="bottom" fields="name" title="Q2" minimum="0" maximum="200">
        <apex:chartLabel display="none" rotate="315"/>
    </apex:axis>
    <apex:barSeries orientation="vertical" axis="left" stacked="true" xField="name" yField="Actual,Forcast,Planned" colorsProgressWithinSeries="True" colorSet="blue,Magenta,Yellow,LightSeaGreen" >
                <apex:chartLabel />

</apex:barSeries>
</apex:chart>  ​

User-added image