Vasu Mittal
Vasu Mittal

Reputation: 1

microsoft dynamics crm 2015 Error in javascript string concatenation

I need to concatenate two strings to make it a useful link. The code goes here:

ODataHost = "https://xyz.dynamics.com/XRMServices/2011/OrganizationData.svc/";
accountId= "{90639159-6E01-E511-80ED-C4346BADA644}";
ODataquery = "AccountSet(guid'" + accountId + "')";
ODataURL= ODataHost + ODataquery;

ODataURL which is not forming a meaningful link and is distorted. The link that is formed is: https://xyz.dynamics.com/XRMServices/2011/OrganizationData.svc/AccountSet(guid'{90639159-6E01-E511-80ED-C4346BADA644}') ,but the last characters of the resulting string i.e }') are not a part of resultant string which makes it a distorted link. I have also tried: ODataHost = ODataHost.concat(ODataQuery) but this didn't worked. Please come with a suitable solution .

Upvotes: 0

Views: 246

Answers (1)

Alex
Alex

Reputation: 23300

You need to remove {}, going from this:

https://xyz.dynamics.com/XRMServices/2011/OrganizationData.svc/AccountSet(guid'{90639159-6E01-E511-80ED-C4346BADA644}')

to this

https://xyz.dynamics.com/XRMServices/2011/OrganizationData.svc/AccountSet(guid'90639159-6E01-E511-80ED-C4346BADA644')

Upvotes: 1

Related Questions