• Josh Reigner 2
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi Community,
I am not a developer and am just trying to make, what I thought, was a quick update to an existing button.

The button creates a Project (Custom Object) from a Request (Custom Object).  I need to be able to relate the Request to the newly created Project.  This is the code that creates the project, but I need to then call the ID of the newly created Project and insert it into the Project Lookup Field on the Request so the Request becomes a record of the related list on the Project.  Does that make sense?  Is this even possible?

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 

var Proj = new sforce.SObject("SFDC_Project__c"); 

Proj.SFDC_Project_Name__c = '{!SFDC_Request__c.Name}' 
Proj.SFDC_Project_Description__c = '{!SFDC_Request__c.Request_Detail__c}' 
Proj.Users_Affected__c = '{!SFDC_Request__c.Users_Affected__c}' 
Proj.Segment_specific_or_Veritiv__c = '{!SFDC_Request__c.Segment_Specific_or_Veritiv__c}' 
Proj.Urgency__c = '{!SFDC_Request__c.request_priority__c}' 
Proj.Recommended_Solution__c = '{!SFDC_Request__c.Requirements__c}' 

// {!SFDC_Request__c.SFDC_Project__c} = {!SFDC_Project__c.Id} 

var result = sforce.connection.create([Proj]) 

if(result[0].success=='true'){ 
alert('Project ' + Proj.SFDC_Project_Name__c + ' successfully created'); 
}else{ 
alert('Could not create record ' + result); 
}
 
Hi Community,
I am not a developer and am just trying to make, what I thought, was a quick update to an existing button.

The button creates a Project (Custom Object) from a Request (Custom Object).  I need to be able to relate the Request to the newly created Project.  This is the code that creates the project, but I need to then call the ID of the newly created Project and insert it into the Project Lookup Field on the Request so the Request becomes a record of the related list on the Project.  Does that make sense?  Is this even possible?

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 

var Proj = new sforce.SObject("SFDC_Project__c"); 

Proj.SFDC_Project_Name__c = '{!SFDC_Request__c.Name}' 
Proj.SFDC_Project_Description__c = '{!SFDC_Request__c.Request_Detail__c}' 
Proj.Users_Affected__c = '{!SFDC_Request__c.Users_Affected__c}' 
Proj.Segment_specific_or_Veritiv__c = '{!SFDC_Request__c.Segment_Specific_or_Veritiv__c}' 
Proj.Urgency__c = '{!SFDC_Request__c.request_priority__c}' 
Proj.Recommended_Solution__c = '{!SFDC_Request__c.Requirements__c}' 

// {!SFDC_Request__c.SFDC_Project__c} = {!SFDC_Project__c.Id} 

var result = sforce.connection.create([Proj]) 

if(result[0].success=='true'){ 
alert('Project ' + Proj.SFDC_Project_Name__c + ' successfully created'); 
}else{ 
alert('Could not create record ' + result); 
}