javascriptxsltqbo3

QBO3 How to get the PersonID on a form?


I am working on a Custom Form in a QBO3 system and will be calling some Javascript to save data from the form into the Payment table as a row. When I do this there are two fields that require a PersonID: the CreatedPersonID and UpdatedPersonID.

What code should I use to get the PersonID for the user on the form? Or can I just use a simple XSLT select to find that data? I.e. <xsl:value-of select="…"/>.


Solution

  • The qbo.Security.Utilities.XsltExtension.cs class is made available to all QBO3 XSLTs using the "urn:qbo3-security" namespace.

    In your XSLT, include this namespace in the declaration, such as:

    <xsl:stylesheet version="1.0" xmlns:security="urn:qbo3-security" ...>
    

    and then you can use any of the extension methods, such as:

    <xsl:value-of select="security:userID()"/> // PersonID; e.g. 128
    <xsl:value-of select="security:hasPermission('SomeFunction')"/> // boolean
    <xsl:value-of select="security:isInRole('Administrators')"/> // boolean
    <xsl:value-of select="security:user()//LastLogin"/> // XML node of Person record
    <xsl:value-of select="security:userName()"/> // Person; e.g. admin@quandis.com
    <xsl:value-of select="security:getDefault('qbo.HomePage')"/> // URL of home page
    <xsl:value-of select="security:contactName()"/> // Contact.Contact || Person.Person