Hi all,
I have a requirement of creating multiple tasks at a time when a new case is added based on a dropdown field.
I have used a!writerecords function and have achieved creating multiple records at a time but I have to related the newly created multiple records with a single ID.
I tried it with local variable, tried with expression rule and tried with a rule input of integer field.
I have saved new primary key of the case in a local variable and later saved it in integer rule input using a!save in button. In interface level it was showing that the value is added but the it is not being saved in database.
Discussion posts and replies are publicly visible
Hello tenikark3024
you can use the local!caseDataNum instead of rule input in the a!forEach() of your task Details.Also is there a reason why you are trying to achieve this using a!writeRecords() instead of running a process. More benefits using process to write data as it would give you precise details.
You are aware that you cannot just call a!saveRecords in a expression !?!?
I think we need more context to provide any kind of meaningful help.
I have tried it with local!caseDataNum but the records weren't creating in database.
I have tried with process model but I couldn't achieve it so I have used a!writeRecords() function.
A few things:
1. I'm assuming the case is not written to DB before you are trying to write tasks. If there's a FK constraint added in on rtkl Id column in task table in DB that can cause the write record function to error.
2. I agree, it's better to write in PM and write in sequence: 1. Update new case 2. Write tasks for the new case
If you don't want to follow this practice:
1. Configure onSuccess and onFailure parameters to know what the error might be.
2. The way to calculate the caseDatanum isn't fool proof. You can only query 5000 records. What if your record size is more than 5000? Better query only last record (using sort) and then take max value. As mentioned above, this would only work if there's no FK constraint added in the table.