Announcement

Collapse
No announcement yet.

Side panel and model.attributes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Side panel and model.attributes

    Why do model attributes at panel setup function contain an incomplete list of fields?
    We need to reload the page in browser to get the full model
    Last edited by romach; 12-29-2022, 01:08 PM.

  • #2
    Hi romach,

    Please provide screenshots to investigate this issue in more detail.

    Comment


    • romach
      romach commented
      Editing a comment
      Hi, some details below. This problem has become critical for us

  • #3
    When you open the page for the first time or reload the page in the browser, all model attributes are available. When navigating within the CRM, only the main fields are available. Custom fields are not available.
    Result of console.log(JSON.stringify(this.model.attributes)) :
    PHP Code:
    {"id":"62e77dc43f2b02ff9","name":"CRM PropGen TEST 02","amount":629.5,"stage":"Document approval","createdAt":"2022-08-01 07:16:20 ","number":"PN200029","amountCurrency":"EUR","accountId":"62abac439221a00c9","accountName":"cfw","createdById":"62aac759ee724b23b","assignedUserId":"62aac759ee724b23b""assignedUserName":"PM Tester"}​ 

    Side panel definition

    PHP Code:
    define('custom:views/opportunity/panels/custom-links-panel', ['views/record/panels/side'], function (Dep) {

    return 
    Dep.extend({

    templateContent'<div> \
    <a href="http://localhost/add.php?idOpportunity={{ this.model.id }}&idUser={{ viewObject.userId }}&token={{ viewObject.token }}" target="_blank">Create
    or edit...</a><br/>\
    <br/>\
    <a href="{{ viewObject.aLink }}">Create new project...</a>\
    </div>\
    '
    ,

    setup: function () {
    Dep.prototype.setup.call(this);
    this.wait(
    this.model.fetch()
    );
    this.addName '';
    this.addName += this.model.attributes.'&addname[]=A' '';
    this.addName += this.model.attributes.fs '&addname[]=FS' '';
    this.addName += this.model.attributes.ps '&addname[]=PS' '';
    this.addName += this.model.attributes.po '&addname[]=PO' '';
    this.addName += this.model.attributes.so '&addname[]=SO' '';
    this.addName += this.model.attributes.'&addname[]=C' '';
    this.addName += this.model.attributes.otherCheckbox 'Other' '';

    var 
    user this.getUser();
    this.userId user.id;
    this.userName user.attributes.userName;
    this.token user.attributes.pgToken;

     
    console.log(this.model);
     
    console.log(user);
     
    console.log(JSON.stringify(this.model.attributes)) ;

    this.aLink 'http://localhost2/api/createproject?'
    +'anketkapid=' + (this.model.attributes.projectNumber == undefined ''this.model.attributes.projectNumber)
    +
    '&managerId=' user.attributes.userName
    +'&name=' this.model.attributes.name
                    
    +'&oppId=' this.model.id
                    
    +'&company=' this.model.attributes.accountShortName
                    
    +'&ir_plan=' this.model.attributes.irPlan
                    
    +'&loi_plan=' this.model.attributes.loiPlan
                    
    +'&totalcompletes=' this.model.attributes.nPlan
                    
    +'&sfuniquepn=' this.model.attributes.number
                    
    this.addName '&key=' this.token
                    
    +'&sftarget_a__c=' encodeURI(this.model.attributes.targetAudience);
            },
        });
    });

    ​ 
    Last edited by romach; 12-29-2022, 01:25 PM.

    Comment

    Working...
    X