This topic contains 7 replies, has 0 voices, and was last updated by jerry.jalenak 8 years, 6 months ago.
-
AuthorPosts
-
May 10, 2016 at 8:45 am #9823
jerry.jalenakI need to trigger a workflow on an opportunity ONLY when it is created from a Lead record. I’ve prowled through the fields that are available in the workflow ‘condition’ field, but haven’t been able to find anything like a parent record that I could check against. Is this even possible in a workflow? If so, what are the ‘referring record’ fields that I need to look for?
Thanks!
This is a cached copy. Click here to see the original post. -
May 10, 2016 at 3:19 pm #9824
k_duncHi jerry.jalenak, I’m thinking you might be able to do this by setting the Initiation of your Workflow to Scheduled, then link it to a Saved Search Condition. In your Saved Search, base it on Opportunity record types, then in the Criteria, look for all Opportunities with a Date Created = ‘today’ (if you want it run daily for instance). Then add another criterion of something like (you’ll need to use the ‘Customer Fields…’) Stage = Lead. That might do the trick.
If you need your Workflow to trigger more frequently than say once a day, you might then need to be a little more clever by adding a custom checkbox field, and have your Workflow ‘tick’ it after it’s done its processing. Then in your Saved Search, instead of looking for Opportunities created today, you could look for Opportunities where this checkbox is not ticked (so long as the other criterion exists too).
Anyway, hope that helps.
Cheers,
Kirk.
-
May 11, 2016 at 12:03 pm #9825
jerry.jalenakKirk – Thanks for the ideas. It really needs to be almost transactional – i.e., from the Lead record, when you click on the ‘Create New’ icon and select Opportunity. The normal process is to open a new opportunity form with the lead information copied over – it is at this time that I need to set a couple of fields (on the opportunity) mandatory. Normally I would just make these mandatory at the form level, but the business requirements are such that I can’t do this. From what I can tell, there doesn’t seem to be a way to figure out where I came from (i.e. a Lead record as opposed to anything else).
-
May 11, 2016 at 3:24 pm #9826
k_duncIf this is the case jerry.jalenak, then you might need to do this via a Client Script linked to the Opportunity record, or possibly even a Workflow Action Script within your Workflow. I’d probably recommend the Workflow Action Script, whereby you simply get the Customer ID, then do something like:
Code:
if (nlapiLookupField(‘customer’, id, ‘stage’, true) === ‘Lead’)
{
return ‘T’; // Returns true if the Customer is a Lead
}
return ‘F’;
So this will return ‘true’ if the Customer is a Lead. In your Workflow, create a Workflow Field of type Checkbox that records the return value from the Workflow Action Script. As your first Action in your first State in the Workflow, call your Workflow Action Script and assign the value to the Workflow Field. Next, create an Action Group (or singular Actions if you don’t have many) and a series of Set Field Mandatory actions where your Criteria is ‘true’ for your Workflow Field. That should do the trick.Cheers.
-
May 16, 2016 at 10:16 am #9827
jerry.jalenakKirk – thanks. Unfortunately my requirements have changed since I asked this question. But I’ll definitely file this away for future use!
-
May 16, 2016 at 12:23 pm #9828
jerry.jalenakOk, returning to this thread, and now that I understand the *new* requirements a bit more, here’s what I’m trying to figure out.
From a Lead record, it is possible to create a new Opportunity (either from the Create New bar, or Sales -> Opportunities -> New Opportunity). On the Lead form we have two custom fields that, when the lead is initially created, we may not know the correct values to put in them. However, when an AE tries to create a new opportunity from the Lead, we *MUST* capture the information from the lead before allowing the AE to create the opportunity. So, the flow would be
Lead -> Opportunity (if the custom fields are filled in)
Lead -> error -> fill in the fields -> save -> Opportunity if the custom fields are NOT filled in)
Does this make sense? I’m not sure how to detect what is essentially a button click and fire the workflow off. It’s not really a beforeSubmit / afterSubmit thing since the Lead record can be in View mode, and the Create New -> Opportunity link can be clicked.
Any ideas?
-
May 16, 2016 at 5:49 pm #9829
k_duncHi jerry.jalenak, if I understand your requirement correctly, you only want the AE to be able to create a new Opportunity IF the Custom Fields have been completed? If so, then you’d probably need a Client Script on the Opportunity record using the Page Init Function. In your script, you’d simply check the Custom Fields in your Lead record and perhaps do a redirect to the Lead record if the fields are not filled in.
May I also suggest using a Field Changed Function (just in case your AE creates an Opportunity not from within the Lead record), whereby it checks to see if the ‘customer’ field has been changed, and if so, it does a look-up into that Customer record to once again verify the Stage (perhaps?) and your Custom Fields and return an error message or a redirect (or both).
Is that the sort of thing you’re after?
-
May 20, 2016 at 12:56 pm #9830
jerry.jalenakKirk – essentially, yes. This was pretty much what I had come to, so thanks for validating my approach.
-
AuthorPosts
You must be logged in to reply to this topic.