0

plz suggest. I have a custom object " Asset" and a child object " Car Accessories" ( master-detail relationship). i have created a custom button " Add New" on car access. object to create a new records,the reason being,,  i want a particular " name" to auto-appear (TBA) as the name in the new records. But even if the names is appearing OK, the related asset ID is not showing in the look up field. can anybody plz suggest where i went wrong? Below my javascript code for the new button,

window.location.href="/a36/e?retURL=%2F{!Asset.Id}&assid={!Asset.Id}&Name=TBA&00NN0000002GOcY={!Asset.Name}"

enter image description here

The result being as per below, I am missing the related asset from where i have created the new record. It should appear.

enter image description here

In the new record the URL showing is as below, The name of the related Asset record is " test" which is showing in the URL but not in the detailed page. plz suggest. Thanks  https://cs6.salesforce.com/a36/e?retURL=%2F02iN0000001aYvG&assid=02iN0000001aYvG&Name=TBA&00NN0000002GOcY=test

1 Answer 1

1

The Asset field is waiting for an Asset Id. It will show the Asset name automatically. Here's what i suggest:

window.location.href="/a36/e?retURL=%2F{!Asset.Id}&assid={!Asset.Id}&Name=TBA&00NN0000002GOcY={!Asset.Name}&00NN0000002GOcY_lkid={!Asset.Id}"
11
  • Hello, Martin. Thanks. I tried this one but till the look up field is not populating. Instead i can see in the URL teh related asset ID "cs6.salesforce.com/a36/…"
    – sourav
    Jan 11, 2017 at 8:11
  • I edited my answer. Can you try this? Jan 11, 2017 at 8:16
  • Hi Martin, I tried. But till no success. Although the valus n IDs are appearing in the URL only " cs6.salesforce.com/a36/…". The look up is master-details, i hope thts not an issue. Thanks
    – sourav
    Jan 11, 2017 at 8:21
  • How did you get the field Id? Using the Google Chrome console to inspect the field? Jan 11, 2017 at 8:24
  • Nope, I went to the related field in the " Car Accessories" object, the API name is Asset__c for the look up field. Here i have taken the ID from the URL " cs6.salesforce.com/00NN0000002GOcY?setupid=CustomObjects". Also, if i use the standard button for new record rather than the custom button , this is the URL showing " cs6.salesforce.com/a36/…". Thnx
    – sourav
    Jan 11, 2017 at 8:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .