Scripting

  • 1.  I have a script that runs on Table-PreWrite that c

    Posted 07-14-2017 09:34
    I have a script that runs on Table-PreWrite that checks the users role to be sure they have rights to make changes they're making (oSession.AsObject(oSession.Security).IsMember(""SOL CTR MGR"")). This works the first time, but when they change customers or create a new customer, they get an error. If I remove this line from the script, everything works just fine. Any thoughts or suggestions would be GREATLY appreciated! TIA!


  • 2.  RE: I have a script that runs on Table-PreWrite that c

    Posted 07-14-2017 09:59
    Are you absolutely sure that it is that line that causes the error? I recall seeing some posts that revolved around having issues when you reference oBusObj on sales order script when creating a new customer, something to do with the oBusObj possibly referencing the Customer object.


  • 3.  RE: I have a script that runs on Table-PreWrite that c

    Posted 07-14-2017 10:15
    i can't recall the exact solution but two things come to mind if your script is running on sales orders. You could try either of them one at a time unless someone else knows the exact solution. 1. Try using oSession.SetProgram (refer to help, make sure you set it to the sales entry program) before calling oSession.AsObject(oSession.Security).IsMember(""SOL CTR MGR"") 2. Create your own new SY_Security object (i recommend checking the help on this) and use its IsMember method


  • 4.  RE: I have a script that runs on Table-PreWrite that c

    Posted 07-16-2017 16:18
    David, I'm 99% sure this line is causing the error, when I remove it everything works as expected. It's actually running on the AR Customer table, so no involvement in SO module at all. What it does is check the membership & if they're in that group, it sets automatic defaults to a number of fields.


  • 5.  RE: I have a script that runs on Table-PreWrite that c

    Posted 07-16-2017 16:25
    then you might want to try option 2, use oSession.GetObject(""SY_Security"").


  • 6.  RE: I have a script that runs on Table-PreWrite that c

    Posted 07-16-2017 19:04
    Sam what is the actual error they are getting and can you post a code snippet? Also, are they accessing Customer Maintenance OTF from inside S/O Entry? This seems to work for me for new and existing. ` RoleName = ""SOL CTR MGR"" ` ` isMember = oSession.AsObject(oSession.Security).IsMember(RoleName) ` ` r=oScript.DebugPrint(""isMember = "" & isMember) ` ` If isMember > 0 Then retVal = oBusObj.SetValue(""Comment$"", ""DNB checks out - Finance"") `


  • 7.  RE: I have a script that runs on Table-PreWrite that c

    Posted 08-03-2017 20:24
    Samantha, Did you resolve the problem with .IsMember error? I'm experiencing the same situation in Sales Order Entry after entering a new Ship-To address. Thank you!


  • 8.  RE: I have a script that runs on Table-PreWrite that c

    Posted 03-28-2018 17:18
    I know this is old but i recently have been battling intermittent errors popping up because of oSession.AsObject(oSession.Security).IsMember(""RoleName""). Although IsMember doesn't seem to exist in my v2016 file layouts, i found that it is also a member of the oSession object and can be called simply using oSession.IsMember(""RoleName""). So far, so good.