im trying to trigger a UE script, on EDIT button c...
# suitescript
l
im trying to trigger a UE script, on EDIT button click. I tried this but it doesnt seem to work. Its still triggering on record load (view). how do i fix this?
e
Copy code
if(context.type === context.UserEventType.VIEW)
return;
z
@Livio... what if I say record.load is EDIT Event Type? Do you believe me? It is frustrating, but it is true... record.load is EQUAL TO EDIT...
record.save() will trigger a before and after submit events
l
i just want it to trigger on EDIT button-click but thats not happening right now
z
but, if you talk ONLY for User Interface context (Edit/Open(view)), something is wrong with the setup
c
Is your UE script deployment set to a specific Event Type?
l
@creece no its not
z
@Livio could you please make a screenshot of Deployment for the script
c
Does the script (not the deployment) have "Before Load Function" checked?
The code looks fine
l
yes it does
message has been deleted
z
ok, everything is correct
next : open Execution log, press refresh and make a screenshot
l
message has been deleted
z
.. and for the debug mining, I would put an log.debug before try block (unconditional execution)
Copy code
log.debug(title:'BeforeLoad context', details:context.type)
and how do you know that UE hadn't been triggered, when we see a lot of (too. many if you ask me) debug messages
l
im trying to set a field value, and the script is working but its setting field value on beforeLOAD (VIEW) i want it to set field value when i click edit
z
@Livio you should be more precise... You are mixing more than one possible problem first can be "My userevent beforeLoad is not triggered when is expected" second can be "setting the value of field does not work in user event beforeLoad"
l
My userevent beforeLoad is not triggered when is expected"
z
ok, from execution log I don't see a problem? I see many, many rows at the same time 10:14am... How do you produce so many user events at the same time? you should see one per record view/edit
You cannot modify fields on existing records in beforeLoad; see the Help page for beforeLoad for details. Here's a snippet of beforeLoad limitations: beforeLoad user events cannot be triggered when you load/access an online form. Data cannot be manipulated for records that are loaded in beforeLoad scripts. If you attempt to update a record loaded in beforeLoad, the logic is ignored. Data can be manipulated for records created in beforeLoad user events.