Home General Discussion

How to populate data from PRIMARY USER, CUSTODIAN, LOCATION in a table

Eman_SailaEman_Saila Customer IT Monkey ✭

Dear Cireson Community,


I apologize I didn't put this question in Asset Management, but into General Discussion. The example below is using Asset Management properties as example, but the core question I am asking is generic to many properties in many other classes.


1) I want to search for user in Cireson Web Portal and *quickly* see list of all assets he has on him/her

a) list of assets should have all important properties in *single view* without the need to open up individual items or switch tabs

i.) such list should show these columns:

ASSET TYPE

ASSET DISPLAY NAME

ASSET STATUS

MANUFACTURER

MODEL

SERIAL NUMBER

** CUSTODIAN (DISPLAY NAME)

** PRIMARY USER (DISPLAY NAME)

** LOCATION

LAST MODIFIED

I managed to edit such list in "RelatedUserInfo.js" (...\CiresonPortal\Scripts\forms\templates\RelatedUserInfo.js)

It works pretty well, however Iam having trouble pulling values from assets in 3 columns marked with **


** CUSTODIAN (DISPLAY NAME)

** PRIMARY USER (DISPLAY NAME)

** LOCATION

Apparently, the values in these unique properties are pulled via different method than values from static lists like "Manufacturer" or "Asset Type"


I tested all kinds of property names and syntax, but none of it populates those 3 columns in the generated list...

I am out of ideas...


Can you please teach me correct examples of code to use, to populate these 3 specific columns


In the below example I filled in placeholder code XpropertyX that obviously doesn't work:

CODE PART:

/*********/

/** TAB **/

/*********/

{

name: "Assets",

content: [

{

customFieldGroupList: [

{

name: "Assets - Primary User",

rows: [

{

columnFieldList: [

{ name: "", type: "multipleObjectPicker", PropertyName: "Source_HardwareAssetHasPrimaryUser", ClassId: "C0C58E7F-7865-55CC-4600-753305B9BE64",PropertyToDisplay: {"HardwareAssetType.Name":"Asset Type",DisplayName:"DisplayName","HardwareAssetStatus.Name":"HardwareAssetStatus",Manufacturer:"Manufacturer",Model:"Model",SerialNumber:"SerialNumber",XPrimaryUserX:"PrimaryUser",XCustodianX:"Custodian",XLocationX:"Location",LastModified:"LastModified"}, Disabled: false,ShowAddButton: false, ShowRemoveButton: false, SelectableRow: true, SelectProperty: "DisplayName" }

}

]

},

HOW IT RENDERS ON THE WEB PORTAL:


Answers

  • Eman_SailaEman_Saila Customer IT Monkey ✭

    Here is the same code snippet formated

  • Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
    edited March 2023

    Afaik the following Properties should work:

    OwnedBy.DisplayName:"Custodian"

    Target_HardwareAssetHasPrimaryUser.DisplayName:"PrimaryUser"

    Target_HardwareAssetHasLocation.DisplayName:"Location"


    EDIT: Tried it myself and it doesn't work :(

  • Eman_SailaEman_Saila Customer IT Monkey ✭

    Thanks Simon.

    Unfortunately these do not work.


    Target_HardwareAssetHasPrimaryUser.DisplayName:"PrimaryUser"

    OwnedBy.DisplayName:"Custodian"

    Target_HardwareAssetHasLocation.DisplayName:"Location"

    >> above syntax with adding .DisplayName blocks loading of the page - its stuck on webpage refresh


    "Target_HardwareAssetHasPrimaryUser.DisplayName":"PrimaryUser"

    "OwnedBy.DisplayName":"Custodian"

    "Target_HardwareAssetHasLocation.DisplayName":"Location"

    >> I tried adding "" around the properties as I have seen in other templates 

    >> with "" added, above syntax successfully loads the page 

    >> unfortunatelly like in the original screenshot, columns are empty (no values are displayed for PrimaryUser, Custodian, Location)


    Also tested couple other variations:


    Target_HardwareAssetHasPrimaryUser.FirstName:"PrimaryUser" - page doesn't load

    "Target_HardwareAssetHasPrimaryUser.FirstName":"PrimaryUser" - page loads but column is empty

  • Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
    edited March 2023

    Hello @Eman_Saila yeah shortly after I answered your post I tried it myself and I saw it does not work that way.

    Found this one in the KB:


    I guess this would affect performance too much.

  • Eman_SailaEman_Saila Customer IT Monkey ✭

    Hi Simon,

    Iam not sure I understand what that KB article means in my scenario.

    I guess you were referring to the part saying "Note that this is for properties of the object being related, and not properties of objects related to that object."

    So I guess the object that Iam using in my scenario is:

    "Source_HardwareAssetHasPrimaryUser", ClassId: "C0C58E7F-7865-55CC-4600-753305B9BE64"

    The question is if "Display Name" of "OwnedBy" is a

    a) "property of the object related"

    b) "property of object related to that object"

    I see what you are pointing at... It would be nice if someone could confirm this limitation... Or even better is someone had a way around it :D

    Weird is that in some other templates (for example "HardwareAsset.js") the code is calling directly a property "Target_HardwareAssetHasPrimaryUser" and "OwnedBy" (same as my example) but the web page renders actual USER NAME in the fields

    So in some cases the portal is able to pull a value just by calling "PropertyDisplayName: "PrimaryUser", PropertyName: "Target_HardwareAssetHasPrimaryUser" while in my case the value is not displayed


    Example here from (...\CiresonPortal\Scripts\forms\templates\HardwareAsset.js)

    All below lines from "HardwareAsset.js" successfully pull the actual USER NAME and LOCATION

    {

    columnFieldList: [

             { DataType: "UserPicker", PropertyDisplayName: "PrimaryUser", PropertyName: "Target_HardwareAssetHasPrimaryUser", Disabled: false },

            { DataType: "UserPicker", PropertyDisplayName: "Owner (Custodian)", PropertyName: "OwnedBy", Disabled: false }                     

                         ],

              }

    {


    {

         columnFieldList: [

             { DataType: "ObjectPicker", PropertyDisplayName: "Location", PropertyName: "Target_HardwareAssetHasLocation", ClassId: "B1AE24B1-F520-4960-55A2-62029B1EA3F0", Disabled: false },

             { DataType: "String", PropertyDisplayName: "LocationDetails", PropertyName: "LocationDetails", Required: false, }

                         ],

              }

    {

  • Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
    edited March 2023

    @Eman_Saila

    What you are referencing here, inside the HardwareAsset.js, are properties/relations from the object itself, so e.g. in the Hardware Asset you have:

    Hardware Asset <--> Primary User

    Hardware Asset <--> Location


    In the Multiple Object Picker you would have:

    User <--> Hardware Asset <--> Primary User

    User <--> Hardware Asset <--> Location


    You can even try this behaviour in the HardwareAsset.js itself:

    For example you cannot show the vendor of the purchase order, which this Hardware Asset is related to. You cannot use "Property: Target_HardwareAssetHasPurchaseOrder.Target_PurchaseOrderHasVendor.Displayname" - which would include a relationship of the related object too.

    This would lead to lots of data being pre-calculated before you are able to even open an Object.


    This is just an assumption, maybe I am wrong, but it would make sense.

Sign In or Register to comment.