I'm currently exploring all the possible ways to insert record in a record type (for e.g. StudentDetails is my Record Type) but I have String fields as process variables.
one way I know is (i) Gave Input Variable of StudentDetails type and in Script task Output mapped the values from process variables and used write records.
Discussion posts and replies are publicly visible
You can also just construct the record inside the write records node like this:
'recordType!AAD Attendee'( 'recordType!AAD Attendee.fields.title': pv!stringTitle, . . . )
Can we know why you having multiple process variables(String) instead of single variable of Student..... in the first place?? Having multiple variables consume memory so you need challenge this in the first place.
Well.. I'm exploring and want to stretch more on type casting so this is not a project requirement but just exploring the capabilities dos and don'ts of the product.
appian.rocks/.../
And check this out:
Ok, Then just like you did having an extra expression to cast it to your record type in a separate Script task or directly in write to records or directly in interface (Same approach but change in place)
Got it.Then writing expression at write record level is looking like more organized and better practice to me.Thank you !
No , Script task is better, it gives you better history while debugging .Stefan Helzle any thoughts on this ??
It really depends.
When I get input from the user, I try to populate my record data directly in the interface. This avoids having two locations where that record is manipulated.
Then, I try to avoid separate script tasks, but not at all cost, as hiding complexity in a process model just increases the maintenance effort in the long run.
Next, logic directly in process or a separate expression? Just for compiling a simple record from a few PVs, I would do that in the write records node. But doing anything slightly more complex, create a separate expression.
I think relevant activities or complex logic need to visible, expressive and clear.