nLookupTask returns 0, sLastErrorMsg is empty

SOLVED

I'm trying to read from AP_VendorElectronicPayment and not having a whole lot of luck. I've verified that electronic payments are enabled for the vendor, and I can access electronic payments settings using the same credentials as this code runs under.

After the following lines...

int TaskID = (int)oSS.InvokeMethod("nLookupTask", "AP_VendorElectronicPayment_Ui");
var error = oSS.GetProperty("sLastErrorMsg");

... TaskID is 0 and error is an empty string. I copy/pasted the setup code (i.e. nSetUser, nSetCompany, nSetDate, nSetModule) from another function where I'm reading from AP_Vendor, and that runs just fine.

I've searched the forums and Googled anything I can think of, but nothing's working. Having run out of ideas, I throw myself at your mercy. If it's not obvious, this is in C#, using the Sage-provided DispatchObject class.

Thanks, I really appreciate any help y'all can provide.

  • +1
    verified answer

    Greetings,

    The reason that TaskID is zero is because there is no task for AP_VendorElectronicPayment_UI in Sage 100 since this does not run directly from the Sage 100 Menu.  Instead it is launched from within Vendor Maintenance. You should use AP_Vendor_UI for the argument to LookupTask.

    You should also check the security access for Vendor Maintenance and if it is View Only then don't allow the user to modify the Electronic  Payment Information.  You should also call the Vendor Electronic Payment CheckForInUse() method to see if the AP_VendorElectronicPayment file is in use by another user and if it is (failure) then don't allow the user to modify the Electronic Payment Information.  This follows the security in Sage 100.

    Thanks,

    Kent

    Sage

  • 0 in reply to Kent Mackall

    Thanks Kent, it's working now.

    Where might I have found this information in the documentation? I don't like to ask support for help until I've done my research and come up empty, but I didn't see anything about going to AP_Vendor_UI, and there's an AP_VendorElectronicPayment_UI Program Listing, so I just assumed that was my guy.

    On a related note, and just out of curiosity, why IS there an AP_VendorElectronicPayment_UI program? You mentioned that it's not a task in the Sage 100 menu - does that imply it's menu task in other versions?

    As for security, this is an automated, read-only process I'm developing, so I don't think I need to worry about it, but please enlighten me if I'm wrong about that.

    Thanks again,

    Adam

  • 0 in reply to AdamH
    SUGGESTED

    Adam,

    I can't point to specific documentation that covers this.  It may be covered in a core training class that discusses how security works in Sage 100. Basically, you can look in Roles at the Tasks tab to see what tasks are available and there will be an associated UI class for those tasks.

    In general, anything you do in Sage 100 (Framework Modules) that presents a screen to the user has a UI class.  However; not all UI classes are defined as tasks in Sage 100 as they are not launched from the menu and do not create their own security but inherit their security from a parent or instantiating class. 

    If this is a read-only process then you probably don't need to worry about checking security for View Only but you may want to add some documentation of View Only security into your logic in the event this someday turns into a read/write operation.

    Thanks,

    Kent

  • 0 in reply to Kent Mackall

    If this is a read-only process then you probably don't need to worry about checking security for View Only https://audacity.onl/
    https://mails.tips/temp-mail/
    https://origin.onl/