This topic contains 6 replies, has 0 voices, and was last updated by chanarbon 8 years ago.

  • Author
    Posts
  • #1643

    karenn

    Hi all,

    New day, next project, new problems in the world of SuiteScript 2.0.

    We had a request from users to have a button to create a Return Auth from a Case. Now trying to convert this to 2.0.

    Creating button, no problem. Defaulting customer in RA, problem

    In 1.0, we had a user event script that before load would check for a querystring parameter. If the “caseid” parameter was there it knew it the RA was being created from a Case. The script would load the Case and get the company and startdate. It would then populate the customer and saleseffectivedate in the RA. Worked, no problem.

    So now we go to 2.0, We can get the parameter that was passed, we can get the values from the case but…….currentRecord module is not an option in a user event script. SO, in our beforLoad script how do we set values for this new record we are creating? Since we need the parameter, we can’t do it is a client-side script as far as I know.

    What are we missing?

    Thanks,

    Karen
    This is a cached copy. Click here to see the original post.

  • #1644

    chanarbon

    HI karenn ,

    In beforeLoad function, the scriptContext has a newRecord object where you can set the value. Please check https://netsuite.custhelp.com/app/an…il/a_id/44545/


    david.smith replied on 10/21/2016, 09:20 AM: Has the newRecord bug been fixed? I’ve run into issues with that where I still ended up having to load the record because some functionality wasn’t supported.

  • #1645

    david.smith

    I’m confused.

    If the user has create permissions you should be able to do this client side and then just redirect them to the new record.

    Otherwise, I would create a suitelet to do the job and then redirect. You can use N/record.

    If you have this working in SS1 why are you switching?

  • #1646

    karenn

    newRecord…Thanks! Knew there had to be something like that but was not seeing it. If code completion worked in Eclipse like it used to with 1.0 this would be SOOOOO much easier. I’ll see if that will work for me.

    As to why moving to 2.0……Powers That Be what things converted from 1.0 to 2.0 as time permits and everything new is to be in 2.0/ Slow and painful. I was redoing this so I could then use the same ideas to also create new button they want to create a Credit Memo. We just want to populate the couple fields we can from the RA and then the user has to complete the new record before it is saved. We don;t know enouhg for the Case to actually created a complete new RA or CM

    Once again, thanks all!

  • #1647

    david.smith

    Got it! Cool.

    I think I’d read the parameters on the RA/CM in the page init and then set the values client site in this case (no pun intended).

  • #1648

    karenn

    Learning here…client side might be better but was not seeing how I could get the case id I passed in the URL but then again not easy to find things in 2.0

  • #1649

    chanarbon

    Supporting david.smith ‘s statement for the client side, you can parse window.location.search similar to the parameters

You must be logged in to reply to this topic.