You need to sign in to do that
Don't have an account?
Kathleen Lehnigk
How to combine 2 custom buttons (1 x URL Hack, 1 x Javascript) into 1 button?
Hello everybody,
We've created a new object called Visit Reports in our org. After having created a meeting they will be able to click a button in order to create a new Visit Report record from there. I've created a custom URL-button for that in order to pass on certain values into the new Visit Report Record.
/a18/e?retURL={!Event.What}&CF00ND0000006ECXR={!Account.Name}&CF00ND0000006ECXR_lkid={!Account.Id}&00ND0000006ECXa={!Event.Description}&00ND0000006ECXb={!Event.Location}&00ND0000006ECXY={!Event.ActivityDate}&CF00ND0000006ECXf={!Contact.Name}&CF00ND0000006ECXf_lkid={!Contact.Id}&00ND0000006ECXg={!Contact.Name}&00ND0000006ECXU={!Event.Id}
Unfortunately this does not link the Meeting with the Visit Report record directly, which is why I've created another button on the newly created Visit Report. After clicking this (Javascript) button, the meeting record will be linked with the Visit Report record. For that I'm having an Activity ID field on the visit report record, which the button uses to link the 2 records.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var EvObj = new sforce.SObject("Event");
var VR = new sforce.SObject("Visit_Report__c");
EvObj.Id = '{!Visit_Report__c.Activity_ID__c}';
EvObj.Visit_Report__c = '{!Visit_Report__c.Id}';
EvObj.WhatID = '{!Account.Id}';
var result = sforce.connection.update([EvObj]);
location.reload(true);
My question now is, whether you know of a nice & easy way to combine the 2 buttons into 1. So, that when you create the New Visit Report from the Meeting, it is automatically linked to the Meeting record.
I've used some code from some dev-website to create the Javascript-button. I'm not very knowledgable in this type of coding.
Thank you already in advance for any advice you can give in this matter.
Kathleen
We've created a new object called Visit Reports in our org. After having created a meeting they will be able to click a button in order to create a new Visit Report record from there. I've created a custom URL-button for that in order to pass on certain values into the new Visit Report Record.
/a18/e?retURL={!Event.What}&CF00ND0000006ECXR={!Account.Name}&CF00ND0000006ECXR_lkid={!Account.Id}&00ND0000006ECXa={!Event.Description}&00ND0000006ECXb={!Event.Location}&00ND0000006ECXY={!Event.ActivityDate}&CF00ND0000006ECXf={!Contact.Name}&CF00ND0000006ECXf_lkid={!Contact.Id}&00ND0000006ECXg={!Contact.Name}&00ND0000006ECXU={!Event.Id}
Unfortunately this does not link the Meeting with the Visit Report record directly, which is why I've created another button on the newly created Visit Report. After clicking this (Javascript) button, the meeting record will be linked with the Visit Report record. For that I'm having an Activity ID field on the visit report record, which the button uses to link the 2 records.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var EvObj = new sforce.SObject("Event");
var VR = new sforce.SObject("Visit_Report__c");
EvObj.Id = '{!Visit_Report__c.Activity_ID__c}';
EvObj.Visit_Report__c = '{!Visit_Report__c.Id}';
EvObj.WhatID = '{!Account.Id}';
var result = sforce.connection.update([EvObj]);
location.reload(true);
My question now is, whether you know of a nice & easy way to combine the 2 buttons into 1. So, that when you create the New Visit Report from the Meeting, it is automatically linked to the Meeting record.
I've used some code from some dev-website to create the Javascript-button. I'm not very knowledgable in this type of coding.
Thank you already in advance for any advice you can give in this matter.
Kathleen
Since I'm saving the Activity ID on the Visit Report record I can then do a relation lookup to the Visit Report Primary contact (= Primary contact of Meeting). By then comparing the Activity ID on the Visit Report Record and the existing Meeting IDs on that specific contact record it now links the two together.
All Answers
NOTE: This code has not been tested and may contain typographical or logical errors
Thank you for your reply. Unfortunately your solution does not work. The 2 buttons are currently shown on 2 separate objects. The first one on the Meeting record and the second (where it's using the Javascript and doing the linkage between the 2 records) on the created Visit Report. The button would have to be on the Meeting record only, before the Visit report is created.
Since I'm saving the Activity ID on the Visit Report record I can then do a relation lookup to the Visit Report Primary contact (= Primary contact of Meeting). By then comparing the Activity ID on the Visit Report Record and the existing Meeting IDs on that specific contact record it now links the two together.