Announcement

Collapse
No announcement yet.

Formula Help - addLinkMultipleId

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

  • Formula Help - addLinkMultipleId

    I'm trying to use this but I can't get it to work correctly.

    Where am I going wrong?

    Scenario:

    Relationship: Case <> Meeting

    Field: "DueDate" will have ID of the Meeting

    Code:
    DueDateID= record\create('Meeting', 'name', 'Due Date')
    This was my original code, it perfect. It will create a Meeting call Due Date, and it will then get the ID of the meeting and store if in field call DueDate. The problem arise when I want to assign a team to it. I tried various method, two example that I thought it would work but it doesn't below:

    Code:
    DueDateID= record\create('Meeting', 'name', 'Due Date', entity\addLinkMultipleId('teams', 'idhere123') ) // fail
    DueDateID= record\create('Meeting', 'name', 'Due Date', teamuserIds, entity\addLinkMultipleId('teams', 'idhere123') ) // fail
    
    // Even tried this way by doing this 'update' afterward.
    record\update('Meeting', DueDateID, entity\addLinkMultipleId('teams', 'idhere123'));


    Some link for your reference:




    So... how do we use this? It not problem adding the teams ID to the current entity, but how would I do it for other entity.
    Last edited by esforim; 09-20-2023, 10:33 AM.

  • #2
    maybe this :


    Comment


    • esforim
      esforim commented
      Editing a comment
      Thanks Boss. I will give rabii method a try first.

  • #3
    Originally posted by espcrm View Post
    I'm trying to use this but I can't get it to work correctly.

    Where am I going wrong?

    Scenario:

    Relationship: Case <> Meeting

    Field: "DueDate" will have ID of the Meeting

    Code:
    DueDateID= record\create('Meeting', 'name', 'Due Date')
    This was my original code, it perfect. It will create a Meeting call Due Date, and it will then get the ID of the meeting and store if in field call DueDate. The problem arise when I want to assign a team to it. I tried various method, two example that I thought it would work but it doesn't below:

    Code:
    DueDateID= record\create('Meeting', 'name', 'Due Date', entity\addLinkMultipleId('teams', 'idhere123') ) // fail
    DueDateID= record\create('Meeting', 'name', 'Due Date', teamuserIds, entity\addLinkMultipleId('teams', 'idhere123') ) // fail
    
    // Even tried this way by doing this 'update' afterward.
    record\update('Meeting', DueDateID, entity\addLinkMultipleId('teams', 'idhere123'));


    Some link for your reference:




    So... how do we use this? It not problem adding the teams ID to the current entity, but how would I do it for other entity.
    i have just tried it, if i understand do you the teams of the case to be copied to the meeting ? anyway you can always do it this way simply and it works:

    PHP Code:
    DueDateID record\create('Meeting''name''Due Date''teamsIds', list('650af6a7b43ff6b0a''650af6b124b387847')); 
    If you want to pass the teams from the case entity then you could do it as below:

    PHP Code:
    DueDateID record\create('Meeting''name''Due Date''teamsIds'teamsIds); 



    That should work fine as i have tested it and it works, version 8.0
    Rabii
    Web Dev

    Comment


    • esforim
      esforim commented
      Editing a comment
      Love you. I have feeling it will work! Will give it a try over the weekend.

      I didn't know this 'list('id') exist.

    • esforim
      esforim commented
      Editing a comment
      Update, working perfect.

  • #4
    rabii Would you know how to use the "DateEnd" and Duration in the records?

    Currently all record is create Start and End time to be the same, I tried "duration" but it doesn't seem to do anything. I then try to do a few of these stupid method:

    Code:
    record\update('Meeting', dueDateID, 'dateEnd', datetime\addMinutes(record\attribute('Meeting', dueDateID, dateStart), '90')); // update by finding the ID and adding time to it.
    
    record\create('Meeting', 'duration', '90') // this change the Duration field but it doesn't actual change the time.
    
    record\create('Meeting', 'dateEnd', datetime\addMinutes(dateStart, '90') // I think this doesn't work because Formula don't know what what the dateStart is, as that is a field in Meeting only.
    
    record\create('Meeting', 'dateEnd', datetime\addMinutes(dueDate, '90') // I think this don't work because dueDate is a date only field and it not dateTime field.

    Comment


    • #5
      Originally posted by espcrm View Post
      rabii Would you know how to use the "DateEnd" and Duration in the records?
      Thank guys! Manage to solve it by using Sandbox and trial and error, I did my formula incorrect with the record update, here is the solution if anyone need it:

      Code:
      record\update('Meeting', dueDateID, 'dateEnd', datetime\addMinutes(record\attribute('Meeting', dueDateID, 'dateStart'), 120))
      
      // formula 'step' for beginner reading
      // update a Record
      // For Meeting entity
      // get the ID number in a field call dueDateID
      // the field I want to update is "dateEnd" in my Meeting
      // I want to add Minutes to my record
      // I want to calculate it from the dateStart, but I need to get that data from my Meeting using the record\attribute function
      // I want to add 120 minutes as the end time.
      Last edited by esforim; 09-25-2023, 06:47 AM.

      Comment


      • #6
        hey

        you should use it like below avoid using number as string '120' it should be number 120 instead

        PHP Code:

        record\update
        ('Meeting'dueDateID'dateEnd'datetime\addMinutes(record\attribute('Meeting'dueDateID'dateStart'), 120))
        ​ 
        Rabii
        Web Dev

        Comment


        • esforim
          esforim commented
          Editing a comment
          Thanks rabii, for some reason it still work as a string (or I could be majorly wrong here) but I will fix it.
      Working...
      X