Can someone point out what I am doing wrong ? Earl...
# suitescript
t
Can someone point out what I am doing wrong ? Earlier in 1.0 I was able to get suitelet URL using nlapiresolveurl() at client side. Now comparable resolvescript is not available client side, So I tried to • load deployment and get url • tried using search.lookupfields But it is not going ahead. to load the record. This works in console but not in on demand client script.
I am only getting Error Occured and blank object {} in details.
It works in console. but not here.
s
since you're using on click, i'm gonna suggest on your you pass the link to this handler function, or potentially skip the entire handler function with
Copy code
var triggerThisUrl = url.resolveScript({scriptId:'customscript_sl',deploymentId:'customdeploy_sl'})+'&myParams='+myParams;
context.form.addButton({id:'custpage_button',label:"Click Me",functionName:"window.open('" + triggerThisUrl + "')"});
Then with this, you don't even need this handler CS script
t
Thanks, I agree I can do this, but I am a bit greedy in knowing why any of record.load or search.lookupfields is not working. They work in console.
s
can you change your log.debug or log.error to console.log for starters, then you can start to observe in the developer console in modern browsers note also console.log does not have a title details structure so no commas
if you chrome it's F12, or go right click on the page, inspect, one of the subtab is console, and when you run client scripts the logs are there
s
they aren't working because of line 23... you have re-defined what
record
means
It's never a good idea to store local variables with the same name you are using for the NS modules
t
Ohh, I was to reach there, I was all modules one by one now, How can I be so dumb ! Thanks a lot.
and for the same reason search didn't work.
s
Though, I do agree with sciuridae, it would prob just make more sense to use
url.resolveScript()
and pass that param to the client rather than doing this in the client (since url.resolveScript is not usable client side)
keanu thanks 1
t
Now I can use the that, coz now I know where I was wrong! Thanks a lot brother !
Thanks @Sciuridae54696d for your help.
🙌 1
m
Why is url.resolveScript not usable client side?
message has been deleted
s
Idk, the help documentation says serverside only on it, might be wrong? I didnt try to run in client.
m
Yeah it does too. Probably a mistake