• Jagadish Lutimath
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 5
    Replies
Hi Team,

I am working on "Lightning Experience Rollout Specialist" Super Badge and all of the sudden I am getting this following error
"Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: BIYYUZCU"

PLease do check it and fix this ASAP
public class AP117ACTQualtrics {
   
   @future(callout=true)
   public static void basicAuthCallout(List<Id> IDs){
     
     HttpRequest req = new HttpRequest();
     list<contact> objCon=[select firstname,lastname,email from contact limit 2];
     string endPointUrl='https://eu.qualtrics.com/API/v3/mailinglists/ML_3l39rKNHuEOT0G1/contacts';
     endPointUrl=endPointUrl;
     req.setEndpoint(endPointUrl);
     req.setMethod('GET');
     String username = 'abc@xyz.com';
     String password = '********';
     Blob headerValue = Blob.valueOf(username + ':' + password);
     String authorizationHeader = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue);
     req.setHeader('Authorization', authorizationHeader);
     req.setHeader('content-type','application/json');
     req.setHeader('accept-language','en-US');
     req.setHeader('X-API-TOKEN','w6I0GZXTo12345vyudn7cA8SFBGIXvUvQhXW');
     
     
     string strFname;
     String strLname;
     String strEmail;
     string extdataref;
     string Lang;
     string strEmbededData;
     Id contactId;
     CustomerComplaint__c objContact=[Select id,OwnerId,CustomerContactName__r.FirstName,CustomerContactName__r.LastName,CustomerContactName__r.Email,CustomerContactName__r.Language__c from CustomerComplaint__c where Id=:IDs Limit 1];
     if(objContact!=null){
     contactId=objContact.id;
     strFname='{"firstName": "'+objContact.CustomerContactName__r.FirstName+'",';
     strLname='"lastName": "'+objContact.CustomerContactName__r.LastName+'",';
     extdataref='"externalDataRef":"'+objContact.Id+'",';
     Lang='"language":"'+objContact.CustomerContactName__r.Language__c+'",';
     strEmbededData='"embeddedData": {"sfId": "'+objContact.id+'","sfOwnerId": "'+objContact.OwnerId+'","sfIsDeleted": "false"},';
     strEmail='"email": "'+objContact.CustomerContactName__r.Email+'"}';
     
     }
     string body=strFname+strLname+extdataref+Lang+strEmbededData+strEmail;
     system.debug('body........'+body);
     req.setBody(body);
     Http http = new Http();
     string strConId;
     HTTPResponse res = http.send(req);
     system.debug('res ..........'+res.getBody());
    FetchContactOrDistrId objContact1= new FetchContactOrDistrId();
     objContact1=parse(res.getBody());
     system.debug('objContact.............'+objContact1);
     if(objContact1!=null ){
     strConId=objContact1.Result.id;}
     system.debug('strConId.............'+strConId);
     
     HttpRequest reqDistribution = new HttpRequest();
     string endPointDisUrl='https://eu.qualtrics.com/API/v3/distributions';
     reqDistribution.setEndpoint(endPointDisUrl);
     reqDistribution.setMethod('POST');
     String bodyDis;
     String username1 = 'abc@xyz.com';
     String password1 = '*******';
     Blob headerValue1 = Blob.valueOf(username1 + ':' + password1);
     String authorizationHeader1 = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue1);
     reqDistribution.setHeader('Authorization', authorizationHeader1);
     reqDistribution.setHeader('content-type','application/json');
     reqDistribution.setHeader('accept-language','en-US');
     reqDistribution.setHeader('X-API-TOKEN','w6I0GZXTo12345vyudn7cA8SFBGIXvUvQhXW');
     
     
     bodyDis='{"action": "CreateDistribution","surveyId": "SV_bgEnDhQebQgmtmZ","mailingListId": "ML_3l39rKNHuEOT0G1","description": "ACT Closing Survey List","expirationDate": "2017-12-03 11:22:33","linkType": "Individual"}';
    reqDistribution.setBody(bodyDis);
     Http httpRes = new Http();
     HTTPResponse result = httpRes.send(reqDistribution);
     
    FetchContactOrDistrId DisResult=parse(result.getBody());
    system.debug('DisResultD.............'+DisResult);
    String strDistId;
     if(DisResult!=null){
     strDistId=DisResult.Result.id;}
     
     system.debug('End Method'+strDistId);
     
     
     HttpRequest reqSurvey = new HttpRequest();
     string endPointSurveyUrl='https://eu.qualtrics.com/API/v3/distributions/'+strDistId+'/links?surveyId=SV_bgEnDhQebQgmtmZ';
     reqSurvey.setEndpoint(endPointSurveyUrl);
     reqSurvey.setMethod('GET');
     String bodyDis1;
     String username12 = 'abc@xyz.com';
     String password12 = '*******';
     Blob headerValue12 = Blob.valueOf(username12 + ':' + password12);
     String authorizationHeader12 = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue12);
     reqSurvey.setHeader('Authorization', authorizationHeader12);
     reqSurvey.setHeader('content-type','application/json');
     reqSurvey.setHeader('accept-language','en-US');
     reqSurvey.setHeader('X-API-TOKEN','w6I0GZXTo12345vyudn7cA8SFBGIXvUvQhXW');
     Http httpResp = new Http();
     HTTPResponse resultRes = httpResp.send(reqSurvey);
     system.debug('lstElements.........'+resultRes.getBody());
     
     //string resSurveyLink=objSurvey.parse(resultRes.getBody(),strConId,contactId);
   
   QualtricsJSONparser.parse(resultRes.getBody(),strConId,contactId);
     //system.debug('resSurveyLink...........'+resSurveyLink);
  
     }
     
     
     /*Distrubtion list wrapper*/
  public class Elements {
    public String contactId;
    
    public String link;
       }
    public class Meta {
    public String httpStatus;
    public String requestId;
    public String notice;
    }

    public class FetchContactOrDistrId{
     public Meta meta;
    public Result result;
   
    }
    
    public class Result {
    public String id;
  
    }
    
   
    public static FetchContactOrDistrId parse(String json) {
        return (FetchContactOrDistrId) System.JSON.deserialize(json, FetchContactOrDistrId.class);
        }
}

 
Hi Everyone,

I have written an apex class which has a future method. As of now, I am invoking that class method through triggers and it is working as expected. Here my requirement is, we have a helper class and I need to invoke the future method through the helper class. Can anyone let me know how to invoke the future method from helper class? 

Appreciate any help.
I am trying to fetch data from web to My salesforce CRM. For all fields I am achieving but I want to upload pdf or Doc kind of files while submitting the data from web. I have written code for "Browse" button after submitting the values and uplaoding the file from web I cant able to find the uploaded file in my CRM:( Can anyone please helpme to come out this? 

Many Thanks in advance.
Hi Everyone,

I have written an apex class which has a future method. As of now, I am invoking that class method through triggers and it is working as expected. Here my requirement is, we have a helper class and I need to invoke the future method through the helper class. Can anyone let me know how to invoke the future method from helper class? 

Appreciate any help.
Batch Apex Code:
global class BatchApex implements Database.Batchable<sobject> {
    global DataBase.QueryLocator start(DataBase.BatchableContext bc){
        String query ='select id,name from account';
        return DataBase.getQuerylocator(query);
    }
    global void execute(DataBase.BatchableContext bc,List<Account> scope){
        List<Account> acc=new list<Account>();
        for(Account a:scope){
            a.name ='mr.'+a.name;
            scope.add(a);
        }
        update scope;
    }
    global void finish(DataBase.BatchableContext bc){
        
    }
        }

BatchApex b =new BatchApex();
Database.executeQuery(b,5);