Options for ending a workflow triggered by custom button - Answers - Salesforce Trailblazer Community
Ask Search:
Griff JacobsenGriff Jacobsen 

Options for ending a workflow triggered by custom button

I've created a workflow that runs from the Campaign Member record and passes data into my workflow variables via the URL below.  I would like to have the window close when the Workflow is complete. How do I modify the retURL? It currently goes to the home screen.

/flow/Campaign_Activity_Logging?varCampaignName={!CampaignMember.Campaign}&varContactFirstName={!CampaignMember.Contact}&varCampaignID={!CampaignMember.CampaignId}&varContactID={!CampaignMember.ContactId}&varCompany={!CampaignMember.CompanyOrAccount}&varContactTitle={!CampaignMember.Title}&retURL=home/home.jsp

Thanks
Jessica BJessica B
Closing a window is typically done with HTML code... so if you aren't using a VF page, I don't think this is possible. BUT I would love to see if someone can figure this out!
Griff JacobsenGriff Jacobsen
Perhaps instead of home/home.jsp I could reference a standard page for Campaigns? Any thoughts how I might do that? retURL= campaigns.jsp?
Jessica BJessica B
Since closing a window is typically done with HTML code... so if you aren't using a VF page, I don't think this is possible. BUT I would love to see if someone can figure this out!

If you want to try the retURL function, use what is after the retURL= when you click "New Campaign." For example, when I click the Campaigns tab, my URL is appended with "701" and this may be different for you... so my retURL puts "%2F" before the "701" and "%2Fo" after; you should be able to use that same format: retURL=%2Fxxx%2Fo


(This is what I see when I click new campaign)
https://na6.salesforce.com/701/e?retURL=%2F701%2Fo
Rick PaskeRick Paske
My preference was to open a new window, run the flow and close the window upon finish and prefer not to be using a VF page to launch the flow.  I have not found a way to do this.  Thus, I settled for returning to the record I started from with the following at the end of the string:
  &retURL={!CustomObject__c.Id}

There are cautions in SF documentation about using retURL in this way as you can end up with sidebar and header within a window that already has sidebar and header.  Thus, the custom button behavior I've used is "Display in existing window without sidebar or header".  Thus far, there have been no issues.