• Mohsin.Raza
  • NEWBIE
  • 5 Points
  • Member since 2015
  • Development Team Manager
  • CloudCall


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 9
    Replies
I have a customer who is reporting the below error when my code creates Task record.

Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] 

The whoid for task is usually a contact and whatid is opportunity or case. This is an intermittent issue and is not easily reproducebale. The strange thing is that this occurs when inserting a new task record so we dont know which record is causing this to fail as the task record could not be lock at this point as its not yet created. Can it be that one of the parent records (contact or opportunity) is locked?
Hi,

I am integrating against salesforce Console Intergration API on my visual force page and I am encountering below issues.

1. sforce.console.getTabLink with sforce.console.TabLink.PARENT_AND_CHILDREN option fails when 'New Tab' option is open and waiting for user to enter any URL. See the error below from borwser console.
getTabLink: Cannot read property 'toLowerCase' of null    main.js:391
TypeError: Cannot read property 'toLowerCase' of null method: getTabLink arguments: {"nonce":"ab9a518261b3a8396d57b1e1e5f3e9a83fbe59f83e6a3d90ff83106bc0ccc4db","version":"30.0","level":"complete","tabId":"scc-pt-0"} userAgent:Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.7 Safari/537.36
    at Object.Sfdc.support.servicedesk.checkWhiteList (https://eu5.salesforce.com/jslibrary/1459985950000/sfdc/ServiceDesk.js:331:58)
    at Object.Sfdc.support.servicedesk.stripDomainAndConsoleParamsFromLink (https://eu5.salesforce.com/jslibrary/1459985950000/sfdc/ServiceDesk.js:324:215)
    at Object.Sfdc.support.servicedesk.generateConsoleTabLink (https://eu5.salesforce.com/jslibrary/1459985950000/sfdc/ServiceDesk.js:328:442)
    at Object.getLink (https://eu5.salesforce.com/jslibrary/1459985950000/sfdc/ServiceDesk.js:433:490)
    at Object.getTabLink (https://eu5.salesforce.com/jslibrary/1459985950000/sfdc/ServiceDesk.js:520:205)
    at Object.accept (https://eu5.salesforce.com/support/console/xdomain/30.0/xdomain.js:4:32)
    at a (https://eu5.salesforce.com/support/console/xdomain/30.0/xdomain.js:13:397)log @ main.js:391
(anonymous function) @ main.js:381
log @ main.js:389
b.resolve.b.provide.a.log @ main.js:388
(anonymous function) @ main.js:388
(anonymous function) @ main.js:354
h @ ServiceDesk.js:416
getTabLink @ ServiceDesk.js:520
accept @ xdomain.js:4
a @ xdomain.js:13
ServiceDesk.js:339

2. sforce.console.getTabLink with sforce.console.TabLink.TAB_ONLY option does not work when all the tabs are open in a seperate workspace by clicking 'Pop out primary tabs'. The response received on the call back function is 'Object {success: false}'.
I have a customer who is reporting the below error when my code creates Task record.

Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] 

The whoid for task is usually a contact and whatid is opportunity or case. This is an intermittent issue and is not easily reproducebale. The strange thing is that this occurs when inserting a new task record so we dont know which record is causing this to fail as the task record could not be lock at this point as its not yet created. Can it be that one of the parent records (contact or opportunity) is locked?
Hi All,

I am doing Apex Rest Callouts in Trailhead Apex Integration Service Module.
https://developer.salesforce.com/trailhead/force_com_dev_intermediate/apex_integration_services/apex_integration_rest_callouts

This is AnimalLocator class.
public class AnimalLocator{
    public static String getAnimalNameById(Integer x){
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        
        req.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/' + x);
        
        req.setMethod('GET');
        
        HttpResponse res = h.send(req);
        Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(res.getBody());
        Map<String, Object> animal = (Map<String, Object>) results.get('animal');
        return (String)animal.get('name');
    }
}
However, I was encountered this error when checking challenge.
Challenge Not yet complete... here's what's wrong: 
The Apex class does not appear to be calling the REST endpoint using HttpRequest.
I have no idea what it means, but I have call the REST endpoint.
  • December 24, 2015
  • Like
  • 0
When using the Identity URL, I have a client who is getting Bad_OAuth_Token. The same code works in the same instance for other clients. The instance is na16.

The code is:
static public String protocolAndHost {
        get {
            if (protocolAndHost == null) {
                //memoize
                String orgId = UserInfo.getOrganizationId();
                String userId = UserInfo.getUserId();
                String sessionId = UserInfo.getSessionId();

                //use getSalesforceBaseUrl within batches and schedules (not Visualforce), and fix inconsistent protocol
                if (sessionId == null) return Url.getSalesforceBaseUrl().toExternalForm().replace('http:', 'https:');

                PageReference pr = new PageReference('/id/' + orgId + '/' + userId);
                pr.getParameters().put('oauth_token', sessionId);
                pr.getParameters().put('format', 'json');

                //within test context use url class, else derive from identity api
                String data = Test.isRunningTest() ? '{"urls": {"rest": "' + Url.getSalesforceBaseUrl().toExternalForm() + '"}}' : pr.getContent().toString();
                Map<String,Object> result = (Map<String,Object>)Json.deserializeUntyped(data);
                Map<String,Object> urls = (Map<String,Object>)result.get('urls');

                //compose pod from the REST endpoint
                Url rest = new Url((String)urls.get('rest'));
                protocolAndHost = rest.getProtocol() + '://' + rest.getHost();
            }

            return protocolAndHost;
        }
    }


The error return is:
403 status code return from request to https://na16.salesforce.com/id/00Dj0000001tO6KEAU/005j000000BYfmLAAT?format=json&oauth_token=00Dj0000001tO6K%21AQwAQHsiQOYRd7vpLI2.iY0vRYMzUbbiXUkZQiLdx593O2hxAbtIrbjU3TfYa6KTNPBAeVA.Pg3pUQQOrWlJgbsbG7ppWcU8&inline=1
An unexpected error has occurred. Your solution provider has been notified.

Please help!
Hi guys/gals,

Do you have any idea on how to obtain the Cloak of Adventure sweatshirt after completing 5 badges on trailheads?

Source: http://go.pardot.com/l/27572/2016-01-06/4wy4tn?utm_campaign=newyear-trailhead-sweatshirt

I haven't received any email address or notification about the completion after I had received 5 new badges on my profile. 

The sweetshirt looks really cool and I want to get it :D  Ty