• Diwakar G 7
  • NEWBIE
  • 50 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 33
    Questions
  • 18
    Replies
Hi,

Please provide some use case of Salesforce that can be automated using RPA. 

Thanks and Regards,
Diwakar G
Hi,

I have one button which will do batch update and a trigger is written on the same object which checks the present and previous field value. If it is different then I need to make post api call.
Below are codes:

Apex Trigger:
trigger StatusChange on User_Story__c (after update) {
    
    List<User_Story__c> ulist = trigger.new;
    
    for(User_Story__c u: ulist){

    User_Story__c updacc=[select id,name,userStory_reason__c from User_Story__c where id = :u.id];

    if(Trigger.oldmap.get(updacc.id).userStory_reason__c != Trigger.newmap.get(updacc.id).userStory_reason__c){
        
        postrequest.apicall();

}

 }

}

Apex Class:
global class postrequest{

    @future(callout=true)
    public static void apicall(){
            HttpRequest req = new HttpRequest();
        	String endpoint = 'https://diwakarg029.pythonanywhere.com/leep';
        	String jsonData = 'ABC';
        	req.setbody(jsonData);
        	req.setEndpoint(endpoint);
                req.setHeader('Accept', 'application/json');
      		req.setMethod('POST');
      		Http http = new Http();
       		http.send(req);
    }


}
But, I am getting the below error. Please help me.
caused by: System.AsyncException: Future method cannot be called from a future or batch method:
Hi, 

I am trying to make a post request if a field value updates. Below is the code.
trigger StatusChange on User_Story__c (after update) {
    
    User_Story__c u = trigger.new[0];
    User_Story__c updacc=[select id,name,userStory_reason__c from User_Story__c where id = :u.id];
    
    if(Trigger.oldmap.get(updacc.id).userStory_reason__c  != Trigger.newmap.get(updacc.id).userStory_reason__c ){

       Getrequest.apicall();
 }

}
Apex Class:
global class Getrequest {

    @Future(callout=true)
    public static void apicall(){
            HttpRequest req = new HttpRequest();
        	String endpoint = 'https://xxxxxxxx.xxxxxxxxxxxxx.com/xxxx';
        	String temp ='A';
        	String temp1 = 'B';
        	String jsonData = '[{"name":"'+temp+'"},{"Request":"'+temp1+'"}]';
      		req.setBody(jsonData);
        	req.setEndpoint(endpoint);
            req.setHeader('Accept', 'application/json');
      		req.setMethod('POST');
      		Http http = new Http();
       		http.send(req);
    }

}

Above code is working fine for single record update. If it is batch update then only field value is getting updated and it is not making a post call. Please help me.

Thanks and Regards,
Diwakar G
Hi, 

How to fix ApexCRUDViolation for inner query. Below is the query.
proposal = [select Id, Name,(Select Id From PQConfig__Configurations__r) From Proposal__Proposal__c Where Proposal__Opportunity__c =:lead.ConvertedOpportunityId];
I tried the below one to fix the violation. Violation is fixed.
if(!Schema.sObjectType.Proposal__Proposal__c.isQueryable() && !Schema.sObjectType.PQConfig__Configurations__r.isAccessible()) {
     return null;
     }
But, PQConfig__Configurations__r is not an object. Getting error while saving class in Salesforce. Please help me to fix the violation.

Thanks and Regards,
Diwakar G

 
Hi,
 
[{"Name": "US-0000314","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000312","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000315","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000318","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000313","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000317","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000320","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000316","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000322","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000319","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000321","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000324","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000328","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000335","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000337","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000329","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000330","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000336","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000332","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000331","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000334","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000333","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000342","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000344","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000345","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000343","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"}]

I want display the above JSON in below table format in Visualforce page. Please help me.

User-added image
Thanks and Regards,
Diwakar G

Hi,

When I clicked on submit button in visualforce (VF) page it will call the below savePro() function. In the function, I am making post request and returning VF page.
public pagereference savePro(){
        PageReference myVFPage = new PageReference('/apex/Successpage');
        String  jsonData = '[{"name":"'+UserInfo.getUserName()+'"},{"email":"'+UserInfo.getUserEmail()+'"},{"userstory":"'+selected_user_list+'"}']';
		myVFPage.setRedirect(true); 
		String endpoint = 'https://********************';
		HttpRequest req = new HttpRequest();
		req.setEndpoint(endpoint);
        req.setHeader('Accept', 'application/json');
		req.setMethod('POST');
		req.setbody(jsonData);
		Http http = new Http();
		 http.send(req);
        return myVFPage;
    }
But, I am getting the below error.

User-added image
Thanks and Regards,
Diwakar G
Hi,
 
{"totalSize":11,"done":true,"records":[{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqNGAU"},"Name":"F-0000306","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqmGAE"},"Name":"F-0000311","Project__c":"P1","Release__c":"aDv210000008OUTCA2","Username__c":"aaag@bbb.com","Useremail__c":"aaa.g@bbb.com"},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqDGAU"},"Name":"F-0000304","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqXGAU"},"Name":"F-0000308","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqSGAU"},"Name":"F-0000307","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqhGAE"},"Name":"F-0000310","Project__c":"P1","Release__c":"R1","Username__c":"aaag@bbb.com","Useremail__c":"aaa.g@bbb.com"},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004Eq3GAE"},"Name":"F-0000302","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004Eq8GAE"},"Name":"F-0000303","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqIGAU"},"Name":"F-0000305","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqcGAE"},"Name":"F-0000309","Project__c":"P1","Release__c":"R1","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqrGAE"},"Name":"F-0000312","Project__c":"P1","Release__c":"R2","Username__c":"aaa.g@ccc.com","Useremail__c":"aaa.g@bbb.com"}]}
I want display the above json result in below format in visualforce page. How can I acheive this?

Name     Username__c        Useremail__c        Project__c          Release__c



Thanks and Regards,
Diwakar G
Hi,

How to read the values of below json using List and Maps in Apex. 
String recordstring = '[[{"File__c":"classes/VerifyDate.cls"},{"Rule__c":"MethodNamingConventions"},{"Message__c":"Method names should not start with capital letters"}],[{"File__c":"classes/VerifyDate.cls"},{"Rule__c":"MethodNamingConventions"},{"Message__c":"Method names should not start with capital letters"}],[{"File__c":"classes/VerifyDate.cls"},{"Rule__c":"MethodNamingConventions"},{"Message__c":"Method names should not start with capital letters"}]]'
Please help me.

Thanks and Regards,
Diwakar G
 
Hi,

Is it possible to send a mail with attachment using /services/data/v43.0/actions/standard/emailSimple. I tried without attachment, I am able to invoke this API. How to send mail with attachement using this API?

Thanks and Regards,
Diwakar G
Hi,

Is there any rest API available in salesforce for sending email. For that API I need to pass to address, subject, body and attachment. Please provide some sample code to start.

Thanks and Regards,
Diwakar G
I am trying to call Javascript from Visualforce page. Below is the sample code of visualforce page. Here I am trying to call get method. I want to see response. Where it will saved? After clicking on preview in developer console JS will be executed. Where to see the response?
 
<apex:page controller="calljavascript_cls" >

<script>

function func()

{

 var request = new XMLHttpRequest();
 var org_id = '***';
 var user_api_key = '******';

 request.open('GET', 'https://copado.herokuapp.com/json/v1/webhook/metadata/'+org_id+'?api_key='+user_api_key);

 request.onreadystatechange = function () {
 if (this.readyState === 4) {
 console.log('Status:', this.status);
 console.log('Headers:', this.getAllResponseHeaders());
 console.log('Body:', this.responseText);
 }
 };

 request.send();
 }

  </script>

   <apex:outputText value="{!callfunc}" escape="false"></apex:outputText>

  </apex:page>

Below code is the JavaScript.
public class calljavascript_cls

{

public string callfunc{get;set;}
public calljavascript_cls()

{

 callfunc='<script> func(); </script>';

 }

 }

Thanks and Regards,
Diwakar G​​​​​​​
Hi,
Please help me in creating body using Apex. I need to pass the body in post method.
[
    { "n": "MyApexClass", "r": false,  "t": "ApexClass" },
    { "n": "SysAdmin", "r": false, "t": "Profile" },
    { "n": "Account", "r": true, "t": "CustomObject" }
 ]

Thanks and Regards,
Diwakar G
Hi,
I am trying to call api using executeAPI method. The response is jobid. Now, I am checking whether the job is completed or not using checkStatus method continuously in while loop. It will take around 5 min to complete the job.
 
Public class PageController{

        public static String getMethod(String instance_url,String token){
        Http http = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint(instance_url);
        req.setMethod('GET');
        req.setHeader('Authorization', 'Bearer '+token);

        HTTPResponse res = http.send(req);
        String json1 = res.getBody();
        return json1;        
    }

    public static void executeAPI(String token){ 
    String instance_url = 'https://api'; 
    String json1 = getMethod(instance_url, token); 
    return json1;
 }

      public static void checkStatus(String jobid,String token){
        String instance_url = 'https://api/job/status/'+jobid;
        String json1 = getMethod(instance_url, token);
        Map<String, Object> data1 = (Map<String, Object>) JSON.deserializeUntyped(json1);
        while(data1.get('isFinished') == False)
        {
           json1 = getMethod(instance_url, token);
           data1 = (Map<String, Object>) JSON.deserializeUntyped(json1);
        }
        System.debug('Success');
    }

    public static void mainFunction(){
      token = 'avdndbdn'
      String json1 = executeAPI(token)
      Map<String, Object> data1 = (Map<String, Object>) JSON.deserializeUntyped(json1);

     checkStatus(data1.get('JobId'),token)
     }

}

But, I am getting "System.LimitException: Too many callouts: 101 in API Call" error. Please help me.

Thanks and Regards,
Diwakar G
Hi,
I am trying to call api using executeAPI method. The response is jobid. Now, I am checking whether the job is completed or not using checkStatus method continuously in while loop. It will take around 5 min to complete the job.
Public class PageController{

        public static String getMethod(String instance_url,String token){
        Http http = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint(instance_url);
        req.setMethod('GET');
        req.setHeader('Authorization', 'Bearer '+token);

        HTTPResponse res = http.send(req);
        String json1 = res.getBody();
        return json1;        
    }

    public static void executeAPI(String token){ 
    String instance_url = 'https://api'; 
    String json1 = getMethod(instance_url, token); 
    return json1;
 }

      public static void checkStatus(String jobid,String token){
        String instance_url = 'https://api/job/status/'+jobid;
        String json1 = getMethod(instance_url, token);
        Map<String, Object> data1 = (Map<String, Object>) JSON.deserializeUntyped(json1);
        while(data1.get('isFinished') == False)
        {
           json1 = getMethod(instance_url, token);
           data1 = (Map<String, Object>) JSON.deserializeUntyped(json1);
        }
        System.debug('Success');
    }

    public static void mainFunction(){
      token = 'avdndbdn'
      String json1 = executeAPI(token)
      Map<String, Object> data1 = (Map<String, Object>) JSON.deserializeUntyped(json1);

     checkStatus(data1.get('JobId'),token)
     }

}
But, I am getting "System.LimitException: Too many callouts: 101 in API Call" error. Please help me.

Thanks and Regards,
Diwakar G
Hi,

Please provide the API for fetching metadata types and components. 

Thanks and Regards,
Diwakar G
Hi,

Please provide the webhook api for generating package.xml and metadata, for an org.

Thanks and Regards,
Diwakar G
Hi, 

I am trying to execute Apex test (run synchronous) using rest explorer in workbench. But, the response is null. Please help me.

User-added image

Thanks and Regards,
Diwakar G
Hi,

I want to extract org metadata using webhook API in python. Please hemp me.

Thanks and Regards,
Diwakar G
Hi,
I am trying the below Python code for running Apex test.
import urllib2
from urllib2 import Request, urlopen
import json
values =[{"className":"TestVerifyDate","testMethods": ["testMethod1","testMethod2","testMethod3"]}]
values = json.dumps(values).encode('utf8') 
your_url="http://instance.salesforce.com/services/data/v44.0/tooling/"
req = Request(your_url, data=values,headers = {'Accept':'application/vnd.rn+json','Content-Type':'application/vnd.rn+json','Authorization':'Token token="<hexstring>"'})
response_body = urlopen(req).read()
print response_body
I am not sure what to give in token. I tried giving security token, API key. But, getting the below errror.
raise URLError(err)
URLError: <urlopen error [Errno 1] _ssl.c:480: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>

Please help me.

Thanks and Regards,
Diwakar G​​​​​​​
 
Hi,

I want to run Apex test of an org using salesforce webhook API Python. Please help me.

Thanks and Regards,
Diwakar G
Hi,

I have one button which will do batch update and a trigger is written on the same object which checks the present and previous field value. If it is different then I need to make post api call.
Below are codes:

Apex Trigger:
trigger StatusChange on User_Story__c (after update) {
    
    List<User_Story__c> ulist = trigger.new;
    
    for(User_Story__c u: ulist){

    User_Story__c updacc=[select id,name,userStory_reason__c from User_Story__c where id = :u.id];

    if(Trigger.oldmap.get(updacc.id).userStory_reason__c != Trigger.newmap.get(updacc.id).userStory_reason__c){
        
        postrequest.apicall();

}

 }

}

Apex Class:
global class postrequest{

    @future(callout=true)
    public static void apicall(){
            HttpRequest req = new HttpRequest();
        	String endpoint = 'https://diwakarg029.pythonanywhere.com/leep';
        	String jsonData = 'ABC';
        	req.setbody(jsonData);
        	req.setEndpoint(endpoint);
                req.setHeader('Accept', 'application/json');
      		req.setMethod('POST');
      		Http http = new Http();
       		http.send(req);
    }


}
But, I am getting the below error. Please help me.
caused by: System.AsyncException: Future method cannot be called from a future or batch method:
Hi, 

How to fix ApexCRUDViolation for inner query. Below is the query.
proposal = [select Id, Name,(Select Id From PQConfig__Configurations__r) From Proposal__Proposal__c Where Proposal__Opportunity__c =:lead.ConvertedOpportunityId];
I tried the below one to fix the violation. Violation is fixed.
if(!Schema.sObjectType.Proposal__Proposal__c.isQueryable() && !Schema.sObjectType.PQConfig__Configurations__r.isAccessible()) {
     return null;
     }
But, PQConfig__Configurations__r is not an object. Getting error while saving class in Salesforce. Please help me to fix the violation.

Thanks and Regards,
Diwakar G

 
Hi,
 
[{"Name": "US-0000314","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000312","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000315","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000318","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000313","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000317","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000320","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000316","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000322","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000319","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000321","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000324","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000328","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000335","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000337","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000329","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000330","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000336","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000332","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000331","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000334","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000333","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000342","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000344","Project":"TestPOC","Release":"Dec-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000345","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"},{"Name": "US-0000343","Project":"TestPOC","Release":"Feb-GGGG","Username":"AAA.g@ccc.com","Useremail":"AAA.g@BBB.com"}]

I want display the above JSON in below table format in Visualforce page. Please help me.

User-added image
Thanks and Regards,
Diwakar G

Hi,
 
{"totalSize":11,"done":true,"records":[{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqNGAU"},"Name":"F-0000306","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqmGAE"},"Name":"F-0000311","Project__c":"P1","Release__c":"aDv210000008OUTCA2","Username__c":"aaag@bbb.com","Useremail__c":"aaa.g@bbb.com"},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqDGAU"},"Name":"F-0000304","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqXGAU"},"Name":"F-0000308","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqSGAU"},"Name":"F-0000307","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqhGAE"},"Name":"F-0000310","Project__c":"P1","Release__c":"R1","Username__c":"aaag@bbb.com","Useremail__c":"aaa.g@bbb.com"},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004Eq3GAE"},"Name":"F-0000302","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004Eq8GAE"},"Name":"F-0000303","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqIGAU"},"Name":"F-0000305","Project__c":"P1","Release__c":"R2","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqcGAE"},"Name":"F-0000309","Project__c":"P1","Release__c":"R1","Username__c":null,"Useremail__c":null},{"attributes":{"type":"User_Story__c","url":"/services/data/v44.0/sobjects/User_Story__c/aEX210000004EqrGAE"},"Name":"F-0000312","Project__c":"P1","Release__c":"R2","Username__c":"aaa.g@ccc.com","Useremail__c":"aaa.g@bbb.com"}]}
I want display the above json result in below format in visualforce page. How can I acheive this?

Name     Username__c        Useremail__c        Project__c          Release__c



Thanks and Regards,
Diwakar G
Hi,

How to read the values of below json using List and Maps in Apex. 
String recordstring = '[[{"File__c":"classes/VerifyDate.cls"},{"Rule__c":"MethodNamingConventions"},{"Message__c":"Method names should not start with capital letters"}],[{"File__c":"classes/VerifyDate.cls"},{"Rule__c":"MethodNamingConventions"},{"Message__c":"Method names should not start with capital letters"}],[{"File__c":"classes/VerifyDate.cls"},{"Rule__c":"MethodNamingConventions"},{"Message__c":"Method names should not start with capital letters"}]]'
Please help me.

Thanks and Regards,
Diwakar G
 
Hi,
I am trying to call api using executeAPI method. The response is jobid. Now, I am checking whether the job is completed or not using checkStatus method continuously in while loop. It will take around 5 min to complete the job.
Public class PageController{

        public static String getMethod(String instance_url,String token){
        Http http = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint(instance_url);
        req.setMethod('GET');
        req.setHeader('Authorization', 'Bearer '+token);

        HTTPResponse res = http.send(req);
        String json1 = res.getBody();
        return json1;        
    }

    public static void executeAPI(String token){ 
    String instance_url = 'https://api'; 
    String json1 = getMethod(instance_url, token); 
    return json1;
 }

      public static void checkStatus(String jobid,String token){
        String instance_url = 'https://api/job/status/'+jobid;
        String json1 = getMethod(instance_url, token);
        Map<String, Object> data1 = (Map<String, Object>) JSON.deserializeUntyped(json1);
        while(data1.get('isFinished') == False)
        {
           json1 = getMethod(instance_url, token);
           data1 = (Map<String, Object>) JSON.deserializeUntyped(json1);
        }
        System.debug('Success');
    }

    public static void mainFunction(){
      token = 'avdndbdn'
      String json1 = executeAPI(token)
      Map<String, Object> data1 = (Map<String, Object>) JSON.deserializeUntyped(json1);

     checkStatus(data1.get('JobId'),token)
     }

}
But, I am getting "System.LimitException: Too many callouts: 101 in API Call" error. Please help me.

Thanks and Regards,
Diwakar G
Hi,

Please provide the API for fetching metadata types and components. 

Thanks and Regards,
Diwakar G
Hi, 

Please help me to convert the below code to Python. 
var xhttp = new XMLHttpRequest(); 
xhttp.open("POST", "http://instance.salesforce.com/services/data/v44.0/tooling/runTestsSynchronous/", true) 
xhttp.setRequestHeader("Authorization", "OAuth <SESSION_ID>") 
xhttp.setRequestHeader('Accept',"application/json"); 
testObject = {tests: [{classId: "N0tARealClassId", testMethods: ["testMethod1", "testMethod2"]}]} 
requestObject = json.stringify(testObject); 
response = xhttp.send(requestObject) 
response = JSON.parse(response)

This code is used to run Apex test. Please help me.

Thanks and Regards,
Diwakar G
Hi,
I am trying to read the body of attachment and writing in a text file using Python. Below is the sample code. 
import urllib
import requests
import base64
import json
from simple_salesforce import Salesforce
import urllib.request as urllib



instance = ''

sf = Salesforce(username='username', password='password', security_token='security_token')
sessionId = sf.session_id

attachment = sf.query("SELECT id, name,Body FROM Attachment where parentID =''")
body = ""

req = urllib.Request('https://%s.salesforce.com/services/data/v38.0/sobjects/Attachment/<id>/Body/' % instance,
    headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer %s' % sessionId })
f = urllib.urlopen(req)
f1 = open("demofile.txt", "wb")
for x in f:
    f1.write(x)
f.close()
f1.close()
But, I am getting below error.
f1.write(x)
TypeError: write() argument must be str, not bytes
Please correct me, if something is wrong.

Thanks and Regards,
Diwakar G
Hi,

In the below figure, Requesterdetail is a custom object. I have created the lookup releationship. when I clicked search button it is showing only id. But, there are two more field present in the object. I want those two fields to be appear in this page along with Id. Please help me.

User-added image

Thanks and Regards,
Diwakar G
Hi,

I have button which is linked to Visualforce page. If I click on this button, in background internally it is taking id and some more parameters for creation of record. The visualforce page and controller class is hidden. Details I cannot see.

I want to trigger this button to click automatically. How can I do this?

Thanks and Regards,
Diwakar G
Hi,
I have written the following soql query for fetching the last created record.

SELECT id, name,Body,parentID FROM Attachment order by CreatedDate DESC limit 1

But I am getting this error. Please help me. Thanks in advance.

System.QueryException : Non-selective query against large object type (more than 200000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
Hi,
 
During commit files in copado, manually components were selected. Lot of manual work is required sometimes 400 to 500 components are selected at a time. Is there way to automate this?