Create Records in Workflow for Dummies

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • just_me
    Junior Member
    • Jul 2019
    • 25

    Create Records in Workflow for Dummies

    Well,

    i wanted to figure out, how to create a record in another entity, when a field changes (one level up would be a linked field in Acccounts, which would have a specific content)

    In workflows i create a new workflow, in this case i want to create a new Quote, when i change the field description (this doesn't make any sense, i know, but just for figuring out, how this featore works)

    So i did this:

    Click image for larger version

Name:	grafik.png
Views:	185
Size:	31.4 KB
ID:	107765

    And added an action:

    Click image for larger version

Name:	grafik.png
Views:	101
Size:	15.6 KB
ID:	107766

    I want the quote to utilize invoice address of the account (automatically while quote being created, and set the Status to Approved and Name to Implementation.

    Whatever ei do, whether i use the function or not, it won't create anything although the field description is being changed, i'd assume, it should create at least something?

    What am i missing? I tried to figure out by search and reading docs, but i am missing a complete Example.

    Perhaps i should have used something like this: 'accountId', id or 'accountId', $id respectively, but since i'm not a programmer, i might be running short on syntax.

    So, am i barking up the wrong tree? I tried to make sense of this; because i wanted to figure out how this is going to work... before buying the package containing workflows...

    Thanks and best
    j_m
    PS: Yes, this relates to my earlier post about budget control, i just try to figure out a processs, and workflows might be helpful.
  • lazovic
    Super Moderator
    • Jan 2022
    • 810

    #2
    Hi just_me,

    There is no point in using the formula function to create a record if you are already creating that record with a workflow action.

    The following workflow option should work for you (after changing the description of a quote, a new quote will be created with the fields values ​​specified in the workflow action):

    Click image for larger version

Name:	image.png
Views:	87
Size:	40.9 KB
ID:	108505

    Comment

    • lexman
      Junior Member
      • Mar 2022
      • 2

      #3
      just_me

      I suggest not to use the "Create Record" Action instead use the "Execute Formula Script" Action. My sample code is below (it works and tested):

      PHP Code:
      $AccountAddress= record\findOne('Account', null , null,  'name=', string\trim(somename));;
          record\create("Quote",
          "quoteAddress", $AccountAddress,
          <add other fields>
          );
      I note something i could not understand. The target entity is Quote and you trying to create Quote, is this correct? Are you trying to create a new Quote because there is change in the current Quote entity?
      Last edited by lexman; 07-18-2024, 06:22 AM.

      Comment

      Working...