hello everyone. quick question. not sure if this p...
# general
v
hello everyone. quick question. not sure if this possible yet without the use of scripting. I have created two custom body fields in 2 different records(case and quote). The field in the quote should source the value from the case record. I can already do this with sourcing and filtering. Is it possible that if I edit the field from the quote level, the value will retain.
s
Retain old value you mean?
v
for ex. value in Case is A. so the value in Quote is also A. Right now, if I change the value in Quote to B, after saving it goes back to A.
s
Might have to set it by workflow when field is empty and quote is not null and make sure to set this field null someone copy quote
m
Yeah, for this you would need to use scripting or workflows. The script or workflow would not be hard though. As I know scripting better, you'd want to do is: (1) Write a User Event script and hook into the Before Submit event (2) Ask for the oldRecord value for that field, and check if the value differs from the newRecord value for that field. (3) If it differs, set the value of the newRecord value for that field to the oldRecord value for that field.
v
Hello @Michael Pope, Thank for the suggestion. I have tried the scripting approach and the newRecord value is not retained after saving. I logged it after setting the value and the correct value is being set. But after saving the it reverts back to the previous value. Any thoughts?
m
@voidle0917 Mind posting your code? I'll take a look.
v
Here it is. @Michael Pope
m
@voidle0917 Thanks. It's in beforeSubmit, correct?
v
It is beforesubmit
m
hmmm
What type of field is custbodyscg_ship_to_quote. is it List/Record?
v
it is a List/Record:Address Book sourcing from another custom field from a Case Record
m
How is that sourced? Is it sourced using Sourcing/Filtering in the Edit Field Type UI? Or is it sourced using code/workflow?
v
via native Sourcing/Filtering.
m
So I don't use native Sourcing/Filtering much... so I can't be sure it's tied to that... but if it isn't critical, try disabling the Sourcing/Filtering and see if the edit goes through. Not sure if it will or not to be honest.
(Not sure if the sourcing/filtering stuff effects this or not...)
Oh, one other question, Store Value is on, correct? (should be, but I wanted to check).
v
Store Value is not on since it sources. I think I would need to look for other ways for this since it seems I cannot override it via script. Thanks for the help btw.
m
@voidle0917 No problem! Also, yeah, if store value is not on, the method I described above would not work (it will not save any data, even if you change the field).
(but honestly... if Store Value is not on, it should not save your changes to a field regardless... it will just follow your sourcing and filtering rules, and that's it. Editing the value of the field in any way becomes pointless)
One thing you could try is overriding the default value of the field in beforeLoad.... but this is kinda finnicky at times.