• Tasnim M. Tailor
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Sr. Salesforce Developer
  • KUKA North America


  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I am not able to get through this challenge. 
I logged in through SOAPUI and used the session id to create an account. The account gets created and returns success. However when I try to validate the challenge in trailhead, it gives me an error - 

Challenge Not yet complete... here's what's wrong: 
It doesn't appear that you have logged in using SoapUI.

I am not sure what did I miss out.
I am not able to get through this challenge. 
I logged in through SOAPUI and used the session id to create an account. The account gets created and returns success. However when I try to validate the challenge in trailhead, it gives me an error - 

Challenge Not yet complete... here's what's wrong: 
It doesn't appear that you have logged in using SoapUI.

I am not sure what did I miss out.
Hi All,
i write a batch in which i am bringing zendesk organizations to salesforce Account. now i want that if the Account already exists than it should not insert again just the zendesk id which i am bringing from zendesk is put in  Zendesk_Id__c which is a field on Account.
i tried to do it but its not correct.in bold lines i tried.Anyone help me out with this requirement?
my batch class is given below:-
/*
 * Batch to upsert Zendesk Organizations into salesforce Account
*/
public class BatchZendeskToSalesforceAcc implements Database.Batchable<String>,Database.AllowsCallouts, Database.Stateful{
    // start method to return the list of end points of Zendesk Organizations
    public Iterable<String> start(Database.BatchableContext BC){
        List<Account> accList = new List<Account>();
        List<String> endPoints = new List<String>();
                 // instance of class ZendeskApis to call organizations Api
         ZendeskApis.AccountJSON2Apex firstRecords =  ZendeskApis.ZendeskAccountApi();
        Map<String , Id> mapzendeskIdToAccountId = new Map<String, Id>();
        for(Account acc : [Select id, Zendesk_Id__c 
                          from account 
                          where Zendesk_Id__c != null]){
           mapzendeskIdToAccountId.put(acc.Zendesk_Id__c, acc.Id);                      
        }
        accList.addAll(insertAccountData(firstRecords, mapzendeskIdToAccountId));
        if(accList.size() >0){
          Database.upsert(accList, false);
        }
        
        
        Integer totalRecords = firstRecords.count ;
        
        if(test.isRunningTest()||(totalRecords > 100 && 
           firstRecords.next_page != null && 
           firstRecords.next_page != '')){
               totalRecords = test.isRunningtest() ? 2 : totalRecords/100;
                for(Integer i= 2; i< totalRecords+2; i++){
                   String currentEndPoints = firstRecords.next_page;
                   currentEndPoints = currentEndPoints.substringBefore('?');
                   currentEndPoints = currentEndPoints + '?page='+i;
                   endPoints.add(currentEndPoints);
               }
           }
        return endPoints;
        
    }
    //execute method to upsert organisations
    public void execute( Database.BatchableContext BC, List<String> endPoints){
        List<Account> accList = new List<Account>();
        Map<String , Id> mapzendeskIdToAccountId = new Map<String, Id>();
       for(Account acc : [Select id, Zendesk_Id__c 
                          from account 
                          where Zendesk_Id__c != null]){
           mapzendeskIdToAccountId.put(acc.Zendesk_Id__c, acc.Id);                      
       }
                 // instance of class ZendeskApis to call Organizations Api
         ZendeskApis.AccountJSON2Apex ajNextRecords =  ZendeskApis.ZendeskAccountNextApi(endPoints[0]);
        accList.addAll(insertAccountData(ajNextRecords, mapzendeskIdToAccountId));
        if(accList.size() > 0){
            Database.upsert(accList, false);
        }
       
     }
     
    public void finish(Database.BatchableContext BC){
        
    }
    // method to insert organization data into Account
    public static List<Account> insertAccountData(ZendeskApis.AccountJSON2Apex accData, 
                                                  Map<String , Id> mapzendeskIdToAccountId){
        List<Account> accList = new List<Account>();
        for(ZendeskApis.AccountOrganizations accWrapData :  accData.organizations){
            Account acc = new Account();
            if(mapzendeskIdToAccountId.containsKey( String.valueOf(accWrapData.id))){
                acc = new Account(Id = mapzendeskIdToAccountId.get( String.valueOf(accWrapData.id)));
            }
            acc.Name = accWrapData.name;
            acc.url__c = accWrapData.url;
            acc.RecordType.DeveloperName = 'Time_Rack';
            acc.External_Id__c = String.valueOf(accWrapData.external_id);
            acc.Group_Id__c = String.valueOf(accWrapData.group_id);
            acc.Shared_Tickets__c = accWrapData.shared_tickets;
            acc.Shared_Comments__c = accWrapData.shared_comments;
            if(accWrapData.domain_names.size() > 0){
                acc.Domain_Name__c = accWrapData.domain_names[0];
            }
            acc.Notes__c = accWrapData.notes;
            acc.Payroll_Vault__c = String.valueOf(accWrapData.organization_fields.payroll_vault);
            acc.Zendesk_Id__c = String.valueOf(accWrapData.id);
            acc.Details__c = accWrapData.details;
            if(accWrapData.tags.size() > 0){
                acc.Tags__c = String.valueOf(accWrapData.tags[0]);
            }
                
            if(!accList.Contains(acc)){
                accList.add(acc);
            }else{
                acc.Zendesk_Id__c = String.valueOf(accWrapData.id);
            }

           
        }
        return accList;
    }
    
}
how to do it?
Any suggestions?
I am not able to get through this challenge. 
I logged in through SOAPUI and used the session id to create an account. The account gets created and returns success. However when I try to validate the challenge in trailhead, it gives me an error - 

Challenge Not yet complete... here's what's wrong: 
It doesn't appear that you have logged in using SoapUI.

I am not sure what did I miss out.