Troubleshooting Trigger Permissions for SSJS Execution/Asset permissions in REST Response Event


(Nick Mok) #1

Hi there!!

I am currently trying to run a SSJS script but I am having issues with permissions, so I’m making this post in case anybody could help and to help any body else out there struggling. I’m on version 6.38.0

My current setup is a trigger which gets called via the event “REST response received” which is run on the Form Contents asset. My goal is to create daily logs for the form, however they need to remain under-construction / private for security reasons. My SSJS is having trouble with these permissions in a public/live setting.

When the form receives a response from the API it is connected to, this trigger is run.
Within this trigger I have a keyword condition which checks a value returned in SSJS via: "%globals_asset_contents_raw:515017^run_ssjs%.


BUT, this is where I am having issues when publicly submitting the form, the SSJS returns nothing. The script at 515017 (which is live) should display the value “515025” which is a child asset that is not publicly available for security reasons. Is there any way to force the trigger to have admin access for this keyword condition?

Here is what Script 515017 Looks like:


The child Asset in the map:
image

Furthermore, I’ve done an experiment with a REST resource with Matrix Passthrough cookie authentication (eg. 515008) in hopes that I can call %globals_asset_contents_raw:515008^run_ssjs% in my trigger. However, this does not work either. Am I using this Matrix Passthrough Cookie wrong?

Below is what this REST resource looks like:

Is there any thoughts as to why this doesn’t work either as a trigger or with a REST call?

If worse comes to worst, for form logging I may just use Data Records and metadata which can be live (previewing them wont show the metadata). I would, however, prefer to secure these assets with permissions, that way we can move it out of the public site asset.

Any help would be greatly appreciated.

Thanks!


(Harinder Singh) #3

You can achieve it via Content API and Rest resource asset. With valid token and credential stored in Rest resource asset, you should be able to print the desired result.


(Nick Mok) #4

Hi Harinder,

Thanks so much for the suggestion, I am diving into this solution as this appears to be the best way in order to keep assets secure with permissions. This is currently working in a live test for us! Thank you again.