Hey Guys, Scratching my head on this one ... Looki...
# suiteflow
c
Hey Guys, Scratching my head on this one ... Looking for a Workflow method to capture the existing (Old Record) Exp Ship Date from an Item Line on a Sales Order into a Custom Trans Line Field - Previous Exp Ship Date. However, you aren't able to Set Field Value in a Sublist Action Group triggered by Before Record Load, Old Record is only available as a Condition, and Workflow Fields and State Fields appear to only be at Record level, not one per Line Level. From this I can then compare the (Current Record) Exp Ship Date != (Current Record) Previous Exp Ship Date, and send the Customer an email "Your Exp Ship Date has been updated from [old date] to [new date]".
m
Can you just make a custom field called previous ship date On create have an action to set previous ship date = ship date Then on edit if previous ship date != ship date then create a transition to a new state In the new state send an email for ship date changed then set previous ship date to equal ship date (both on entry)
This will send the email then change previous ship date to now be the same as the current ship date so if it changes again the sequence will repeat
c
I feel there's a gotcha in there I've encountered, but given I'm now cross-eyed maybe not. Will give it a go.
m
I think the transition based on line level data might be problematic but if you make a saved search criteria for the transition that should do it
Also if using a saved search as the criteria then do an after submit trigger on your transition
👍 1
☝️ 1
d
gotcha might be that whatever is changing your exp. ship date potentially not triggering the workflow? Then workflow only gets triggered (and sends email to customer) when a user next edits/saves the sales order
might be wrong, but something to consider and test
c
@MGBC @David B it's retrieving the prior ship date (red) that's getting me confused (gotcha'd)...
👀 1
d
are you still trying to do this in beforeload? in a UE, only beforeSubmit and afterSubmit have access to the old record, presume workflows are the same/similar
I've got something similar in my NS instance, but we used a script to manage it
c
All BeforeSubmit
👍 1
d
I've done what MGBC's suggested, which is to create a custom transaction line field to hold the previous ship date.
update it during beforeSubmit, and do your emailing if the values are different
c
Yep, also got that - but how to populate is the conundrum
d
right, with workflow.... you're having trouble setting a column field
c
Can reference Old Record in Condition, but not as target of Set Field Value
d
wait, you're trying to set the 'prev. ship date' field in the old record?
c
Nope. Retrieve the value of the old record ship date to populate current record prev ship date.
Diagram above might clarify, or muddy further ... lol
😆 1
Actually slight tweak on Create
👀 1
Inital Ship & Prev =
d
right, I think I've got it now. *brb
c
My original idea, was the last point However I don't think that workflow / state are per line, only per record
👍 1
i.e. cache the existing value on record load, then use it downstream to write back, after user edit
I've got an in house dev who could script it in 15 mins, but it's a line in the sand sort of moment with clients and the ongoing maintenance and troubleshooting broken oobe logic, for everything we script for them. i.e. proving a workflow point
Plus this makes it easier for them to adjust sender, recipient and wording on the associated email notification
d
so, I don't think you need to touch beforeLoad or old record at all. The way I've done it, and the way I believe MGBC was saying, is to just update the custom line field at the end of beforeSubmit every time you save. You can then check that field at the start of beforeSubmit and do your email logic.
c
Old:Ship != Ship is to identify if a change has been made, else exit
Old as in Old Record at time of Before Submit, as opposed to existing, about to be overwritten, database record
👍 1
It's the value in that existing database record's 'ship date' I need to populate the Before Submit records 'previous date' before I write a new 'ship date'
For an old JDE / Oracle DB guy used to SQL, Suiteflow sometimes throws me
d
will ttyl about this if MGBC isn't back first. I think I understand better the requirements. I didn't realise that the workflow was changing the native shipdate, I thought it was the user/another automation
👍🏾 1
c
Appreciate it DBoT
🎉 I believe I've figured out a solution! Will test bright & early tomorrow and report back ... (my brain hurts too much today)
@David B @MGBC the simplest solutions are always the best, need to upgrade my hindsight 😉.
slack bookmark 1
d
that's brilliant
is
ETA Updated
a real field, or a workflow field?
c
Thanks, will be a useful technique for many use cases ... ETA Updated is a real custom body field, was originally line, but didn't see a need (just yet).
👍 1
Onto the next problem ... Sending the notification to the attached contacts on the SO flagged as TO:Order Creator and CC: Alternate Contact ... can't see an obvious way.
m
Create a saved search showing the contacts assigned to the transactions Use NS_CONCAT to make them into one comma separated value Use that to source a non stored custom field on the SO Use that custom field as the recipients of your send email action
1
d
nice article, so recent too 😄
c
Legend @MGBC. Thanks so much!
m
Haha yeah I’ve been seeing a lot of this need lately so thought I’d throw some ideas out there on it. Hope it helps
🙌🏾 1
c
@MGBC they're not ecstatic about the customer email appearing in the CC: line instead of the TO:, did you ever manage to come up with any workarounds?
m
@CraigR yes here is how you can workaround that. 1. When you get to this step in the Blog post make this field as an Email Address type field instead of long text. Also keep the Store Value box checked. Lastly do not set the sourcing from the summary search on this field just yet.
1. _ 2. Then go to your workflow and setup your Set Email action. Select your new email address field you just made as the Recipient field. instead of using the Email field
Then go back to your custom field and change the field type to Free Text or Long text, uncheck the store value box and use the Validating and Defualting tab to enter your saved search like the instructions say
This is a way to "fake out" the system as when first assigned to the workflow it thinks it's an Email Address type field, but then if you change it afterward the WF still works. (NOTE - this is not in the NetSuite documentation so it could stop working at any point)
Hope this helps
c
@MGBC my friend you are dead cert a legend! Worked a treat,thanks heaps!
d
wow, what an ingenious workaround. I'm floored
m
👍glad it helped....
👏 1
🙌🏾 1
c
@MGBC I have identified one flaw in the Saved Search I haven't resolved yet - if the Contact is attached to multiple Customers but the primary Company is not that of the Sales Order, it isn't picked up
d
instead of doing "Company" as the available filter, does it work if you instead use "Customer"?
c
Unfortunately not
🫤 1
The only fields that correctly return both Customers the contact relates to are -
I haven't yet tried changing the Saved Search filter to a Formula to match datatypes
"Entity" on the Body Field works but doesn't support the scenario either
d
got it
custom fields that default their value from a search are only "inserting" the value of the field as the filter for the search's available filter. So in this case, the field "Customer"'s internal id is the value, so we could have the available filter be the "Company" native list/record field. Or we could use "Customer : Internal Id" as the available filter. 💣 💥
love collaborating with the two of you 🙇👏
c
wow it works, great pickup Dave !!!!!
PS - I love you too 💋 hahahaaaa
😊 1
d
this is an issue that has eluded me before, so I'm very happy to have found it
1
m
@David B great call out. The filter does take a little playing around. Especially when it comes to customer/company/entity tables which are always confusing to work with
🙃 1
c
I do agree with DBoT, it is a great experience collab'ing with you guys, my sincere thanks for helping making me look good ;-)
😆 1