Create process model to create a record type "Order" and multiple record types "Product Variation"

Hello everyone. I am new in Appian and am trying to build a web app "Canteen" as part of my learning path.

Couldn't find anything in other posts as I don't know how to search it.

So my issue is the following...

I have a Canteen Menu where each user can select products to add in the cart. On the interface I build a list of

product variations (with a tempId in order to update something since I haven't saved anything on DB). When I press

the "Place Order" button, I want to create a new "Order" with some fields and then get the ID of the created record.

Then I will use the orderId and create the related "Product Variations" from the selected products list.

How can I do this in the process model?

     

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Thank you Stefan! Slight smile I am a Web Developer with Wordpress and UI is important when I do things... I was hoping I could do more though in APPIAN. I will get used to it... Stuck out tongue

    Anyway, as I said am new to Appian and started working on this project for 10-15 days... I feel like am progressing slowly. 

    I have the related record functions created from the beginning but don't know If I can use them again to combine my processes...

    I think what Harshit said above is what will be the solution but still struggling...

  • 0
    Certified Senior Developer
    in reply to christodoulosp0001
    I have the related record functions created from the beginning but don't know If I can use them again to combine my processes...

    Yes you can use them , Appian Creates Basic Interface and PM when we click on Generate Actions . We can Customise as per the requirement. 

    I think what Harshit said above is what will be the solution but still struggling...

    If you are not maintaining relationship between Order and Product variation your PM gonna look like this

    If you are maintaining relation One write Records is enough it map's the generated key automatically.PM gonna look like this

  • 0
    Certified Lead Developer
    in reply to christodoulosp0001

    Harshit and I talk about the same things.

    Docs here: https://docs.appian.com/suite/help/23.4/Write_Records_Smart_Service.html#create-records-and-related-records-using-a-process-model

    When you come from UI dev, keep in mind, that Appian is made to implement process driven apps. So, the business process is the core, processes consume and manipulate data, and UI supports people in navigating in that process. That is the core concept (IMHO), and you can adapt it to less structured case management, and highly automatic processes with just some exception management. Trying to force Appian into being a simple CRUD UI framework, will not work.

  • I tried to do what you and Harshit suggested. Also followed Harshit's link to help me solve this.

    Unfortunately I haven't solve it yet.

    I generated a new  Record List Action "New Order" and then went and duplicate it's process Model.

    In my sub interface "CartListing" I have this button

    a!buttonArrayLayout(
    buttons: {
    a!buttonWidget(
    label: "Place Order",
    saveInto: {
    a!save(
    target: ri!record['recordType!{a6586e03-53d4-47ea-8f21-52d658700d3b}ICOS Order.fields.{d6e316f2-f6a2-4c1c-9ecf-0f09487e43eb}orderStatusId'],
    value: 1
    ),
    a!save(
    target: ri!record['recordType!{a6586e03-53d4-47ea-8f21-52d658700d3b}ICOS Order.fields.{cdfc5c50-c0ab-488f-9059-85bf4df21277}message'],
    value: "my test message for direct creation of order and it's products",
    ),
    a!save(
    target: ri!record['recordType!{a6586e03-53d4-47ea-8f21-52d658700d3b}ICOS Order.fields.{0ed5711c-0959-43e6-be09-ccc9b4439ed8}price'],
    value: sum(a!forEach(
    items: ri!listOfSelectedProducts,
    expression: { fv!item["price"] * fv!item["quantity"] }
    )
    )
    ),
    a!save(
    target: ri!record['recordType!{a6586e03-53d4-47ea-8f21-52d658700d3b}ICOS Order.fields.{63b1cfa9-f403-4f5f-922f-53e41c1f9ecf}createdBy'],
    value: loggedInUser()
    ),
    a!save(
    target: ri!record['recordType!{a6586e03-53d4-47ea-8f21-52d658700d3b}ICOS Order.fields.{c8e40714-4e35-49c4-b03d-d2936a384e13}createdOn'],
    value: now()
    )
    },
    width: "FILL",
    style: "SOLID",
    color: "#2f4870",
    loadingIndicator: true
    )
    },
    showWhen: not(local!removeItemFromCart),
    align: "START",
    marginBelow: "NONE"
    )

    I tried only passing a simple recordType!Order as it is in the default form for creating a new Order. Note that on my interface when I tested I got the values I wanted on the "rule input" area, but when I made the action on the page the order was not found in my records.

  • Do you see any error in your proces instance?

  • Hello Harshit. I don't see anything there. How should that work? Maybe it's not recording anything... By the way, I sent you an email. Don't know if you saw it... 

  • I was able to solve my problem. All what Stefan and Harshit said were correct! Thank you!! I had another issue why it wasn't working. It was because I was not initializing the process model when the Canteen Menu (Interface) was opened so I had to make the Interface "Create Order" look like the Canteen Menu. Unfortunately I couldn't have the same visual as in the previous Canteen Menu page but it was close enough. I hope at some point different properties of layouts to be common. It will give people the flexibility to use the one with the correct functionality without "worrying" about how it looks.

    Also had to fix some a!submitLink to a!dynamicLink as it was messing with the submission of the form.