Resolve accounts parentId with the accounts name in JS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bdcitsolutions
    Member
    • Apr 2018
    • 79

    Resolve accounts parentId with the accounts name in JS

    Hello everybody,

    is there a possibility to resolve "o.parentId" from type "account" to the name of the account?

    We've got this in "\client\modules\crm\src\views\calendar\calendar.j s":

    Code:
    convertToFcEvent: function (o) {
        //alert(JSON.stringify(o));
        
        if (o.parentType == "Account") {        
            var event = {
                [COLOR=#FF0000]title: o.name + " " + o.parentId,[/COLOR]
                scope: o.scope,
                id: o.scope + '-' + o.id,
                recordId: o.id,
                dateStart: o.dateStart,
                dateEnd: o.dateEnd,
                dateStartDate: o.dateStartDate,
                dateEndDate: o.dateEndDate,
                status: o.status
            };                
        } else {
            var event = {
                title: o.name,
                scope: o.scope,
                id: o.scope + '-' + o.id,
                recordId: o.id,
                dateStart: o.dateStart,
                dateEnd: o.dateEnd,
                dateStartDate: o.dateStartDate,
                dateEndDate: o.dateEndDate,
                status: o.status
            };
        }
    }
    but wanna have the accounts name instead of the ID.


    Thanks in advance,

    Daniel
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2

    o.parentName is empty?

    Comment

    • bdcitsolutions
      Member
      • Apr 2018
      • 79

      #3
      Originally posted by tanya
      o.parentName is empty?
      Yes, it's "undefined". If we stringify "o", there is no parentName, only the parentId which we wish to be resolved:

      Click image for larger version

Name:	stringify.PNG
Views:	169
Size:	16.3 KB
ID:	41530

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        you need to extend queries
        EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.

        Comment

        Working...