Replies: 2 comments 3 replies
-
Hello @Nawksen There is an example on jumping in and out of ejscript-nuggets (%EJSCRIPT_START etc) here: Another example is this, which i haven't added to the repo (yet): This will pretty much prints out what's inside the context, which also contains the cgiVariables (as you are used to from 'old' crmscripts'), and should give you a better idea of what you have to work with and how you can pass inn variables to your scripts (as you describe). You work with json as you would in a 'normal' javascript. I hope this answered your question :) If not, please do not hesitate to reply in this thread! Any question is appreciated, as it helps us share information to anyone who wants to get started and/or already have started testing out the functionality :) //Eivind |
Beta Was this translation helpful? Give feedback.
-
Cool! I tried it out for a bit, and found that headers are accessible through context. Like in CRMScript, we can use REQUEST-METHOD to only allow a certain request method like GET:
But how would we return a status code other than 200? And what about setting headers? Best regards, |
Beta Was this translation helpful? Give feedback.
-
Can i please have an example snippet on how to create a REST endpoint and fetch url parameters?
IE the JS version of the following code:
`%EJSCRIPT_START%
<%
String myValue = getCgiVariable("myValue");
Map data;
data.insert("You_have_sent: ", myValue);
print(data.toJson());
%>
%EJSCRIPT_END%`
So, when we do a GET to:
customer.fcgi?_sf=0&action=safeParse&includeId=SomeScript&key=SomeKey&myValue=JavaScriptRules
It would return
{"You_have_sent" : "JavaScriptRules"}
Regards
Pär
Beta Was this translation helpful? Give feedback.
All reactions