Skip to main content

HI Team,

We are trying to insert a record for specific scenario for specific task_id value. But in the Custom processes where we added the query for the insert the task_id value is not retrieved for the exection point.

We get this error in logs :

Message: SQL Server exception (137:Must declare the scalar variable "@TASK_ID".) executing following SQL:

 

Kindly revert on the solution for this process to handle the task_id in FSM 

Hi @ajayifs 

Can you please share your configurations? Screenshots would be helpful

Cheers!

 


Please confirm for the same.


hi @Shneor Cheshin Kindly see the screenshots in previous comments. and revert what is missing for this to work,


Hey @ajayifs 

Try wrapping the parameter with quotes. @task_id instead of @task_id

Cheers!


Hi @ajayifs 
When possible, I think it is better practice to use an XML update instead of a direct SQL action. That way, the insert can go though a policy. It also wouldn’t require an elevated permission to execute the message.
You could try something like this (replace the view name with your custom view, of course):
 

<perform_batch>
<sequential_dependent>
<hierarchy_select result_name="attachmentlookup" max_rows="1">
<primary_table>c_(--some custom view--)_view</primary_table>
<attrs>
<attr>c_(--some custom view--)_view.attachment_id</attr>
<attr>c_(--some custom view--)_view.task_id</attr>
</attrs>
<from>
<table>c_(--some custom view--)_view</table>
</from>
<where>
<data_constraint>
<constraint>
<left_operand>c_(--some custom view--)_view.task_id</left_operand>
<operator>eq</operator>
<right_operand>@task_id</right_operand>
</constraint>
</data_constraint>
</where>
</hierarchy_select>
<update_task_attachment>
<task_attachment>
<attachment_id xpath_node=" hierarchy_select_results@result_name='attachmentlookup' ] attachment_id"/>
<task_id>@task_id</task_id>
<insert is_initialized="False"/>
</task_attachment>
</update_task_attachment>
</sequential_dependent>
</perform_batch>

Cheers,
James


Reply