Understanding oUserProfile.getAttribute

 11 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
Ward Mitchell
Veteran Member
Posts: 81
Veteran Member

    LawsonGuru's,

    I am looking as some coding and came across the following line:

    var currentUSERCMP=portalWnd.oUserProfile.getAttribute("company");

    I think it pulls from some user profile obect, but exactly what does it pull for? The line that has:

    var currentPDL=portalWnd.oUserProfile.getAttribute("productline");

    Returns the product line I am currently in but the "company" returns me empty.

    Where is this value being pulled from and how can it be populated are my questions.

    Thanks in advance for the help yall!

    isln_boy
    Basic Member
    Posts: 8
    Basic Member
      For us value is derived from the Employee Self Service Identity, which contains the Company and Employee attributes.

      We have the following code in a Design Studio form which adds a record to HR55.2 based on the user's Company and Employee attributes:

      var sAGSCall=portalWnd.AGSPath;
      sAGSCall += "?_PDL="+portalWnd.oUserProfile.getAttribute("productline");
      sAGSCall += "&_TKN=HR55.2&_EVT=CHG&_LFN=ALL&_TDS=IGNORE&FC=C&LINE-FCr0=A";
      sAGSCall += "&PRG-COMPANY=" + portalWnd.oUserProfile.getAttribute("company");
      sAGSCall += "&EMPLOYEEr0=" + portalWnd.oUserProfile.getAttribute("employee");
      sAGSCall += "&PRG-GROUP-NAME=PRAYSTMT"
      sAGSCall += "&INC-EXC-FLAGr0=I&_OUT=XML&_EOT=TRUE";

      If the value is empty for you, you probably don't have the ESS identity setup for RM ID record.


      Ward Mitchell
      Veteran Member
      Posts: 81
      Veteran Member
        We are only running GL (AM,AP,CB,FB) via S3. Is there a way to use oUserProfile.getAttribute to pull data out of the user profiles stored in the RM Admin? We were told by a consultant that we can pull from fields like:

        oUserProfile.getAttribute("company")  - this delimits all companies user has access to via a comma (1000,2000,3000 etc)

        Is this truly possible or a myth?

        We can get the productline attribute, so there has to be someplace where we can update attributes and use them via javascript in our custom screens.

        HELP!!!!
        David Williams
        Veteran Member
        Posts: 1127
        Veteran Member
          All of the attributes you're looking for have to be set up in Lawson Security. Company/Employee, Requester, etc. are Identities that are set up by product line so if you're working in PROD the identity would be PROD_EMPLOYEE or PROD_REQUESTER. Within Portal if you enter Ctrl + Alt + A keys you will see a listing of your Attributes that can be retrieved using oUserProfile.getAttribute.
          David Williams
          Ward Mitchell
          Veteran Member
          Posts: 81
          Veteran Member
            David, great to hear from you again.

            So explain this, I am the developer keep in mind, how would our admins go about setting up Lawson Security to assign the company(ies) users have access to so that I the developer can user the company attribute in screens to lock things down with some customizations?
            David Williams
            Veteran Member
            Posts: 1127
            Veteran Member
              It almost sounds like you're trying to use Design Studio to perform functions that should be built by Security rules (limit companies, etc.). This can be done but it isn't the best way to handle data level security.

              That being said, you can add Identities to users within Lawson Security which you can retreive and use within your forms. I'm not sure how to explain it better than that.

              David Williams
              John Henley
              Posts: 3353
                Your other option is to use the Lawson Schema Editor to add a custom attribute.

                Thanks for using the LawsonGuru.com forums!
                John
                Ward Mitchell
                Veteran Member
                Posts: 81
                Veteran Member
                  @ConsultDavidW - the screen we need to lock down is AP92 - companies can see each others data unfortunetly with no CTPs in sight.

                  @John - thanks for the heads up, we will check that out!
                  John Henley
                  Posts: 3353
                    Posted By Ward Mitchell on 11/16/2010 01:30 PM
                    @ConsultDavidW - the screen we need to lock down is AP92 - companies can see each others data unfortunately with no CTPs in sight. 

                    I agree with David that this is security-related, and should be handled via LAUA security classes or LS Security rules..
                    Thanks for using the LawsonGuru.com forums!
                    John
                    Jason Beard
                    Veteran Member
                    Posts: 124
                    Veteran Member
                      First, I agree with John et all that this is specifically a security issue.

                      that being said, John mentioned something in his previous post that I use frequently but not quite in the same fashion. Adding a custom attribute. You certainly could edit the schema etc but that to me seems a bit overly complicated and probably outside the scope of what many out there want to do with their system. I implement this concept by creating a custom identity and add as many custom attributes to that identity as necessary to handle the specific need. This allows for flexibility and insulation from upgrades which I don't believe the schema editor provides.
                      The process is fairly simple:
                      1. go to your GENDIR/install/agents
                      2. make a copy of one of the delivered agent files (cp Employee.xml Client_Custom.xml
                      3. Edit the Client_Custom.xml to give it a new name (XXX_CUSTOM)
                      4. Change the ID node to something of your choosing
                      5. Edit the IdentityAttrList and SvcEntryAttrList nodes to match the attributes you would like to add. You cannot re-use an attribute that Lawson has already setup so you should prefix the attribute name with something unique ie CS_COMPANY,CS_EMPLOYEE rather than Company,Employee. This also allows you to default an employee value for an individual without necessarily limiting them to that employees data.
                      6. Once the file is ready, load it using ssoconfig (ssoconfig -l sso_config_pwd filename.xml

                      At this point you can add the identity to users via lawson security, use it in custom security roles and also use it in design studio via oUserProfile.getAttribute

                      Jason Beard
                      jbeard@BayStateCI.com
                      617-548-5568
                      Jason Beard
                      617-548-5568
                      jabeard3@gmail.com
                      Kate Liamero
                      Veteran Member
                      Posts: 70
                      Veteran Member
                        when you do the ctrl-alt-a in the protal what tab shows the user.profile get attribute?
                        Ward Mitchell
                        Veteran Member
                        Posts: 81
                        Veteran Member
                          @Jason Beard - I had been looking into custom attributes and was able to figure it out and that is what we have decided to use. I have some code I wrote (javascript) that can pull the arrayed items delimited out. So we are good!

                          @Kathyrn and all: Thanks so much for your insights and ideas. We are good now!

                          Thanks!