Skip to main content
Question

Custom process for After commit insert is not picking the value of @task_id


Forum|alt.badge.img+7
  • Sidekick (Partner)
  • 23 replies

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 

5 replies

Shneor Cheshin
Superhero (Employee)
Forum|alt.badge.img+28
  • Superhero (Employee)
  • 1137 replies
  • December 4, 2023

Hi @ajayifs 

Can you please share your configurations? Screenshots would be helpful

Cheers!

 


Forum|alt.badge.img+7
  • Author
  • Sidekick (Partner)
  • 23 replies
  • December 4, 2023

Please confirm for the same.


Forum|alt.badge.img+7
  • Author
  • Sidekick (Partner)
  • 23 replies
  • December 4, 2023

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


Shneor Cheshin
Superhero (Employee)
Forum|alt.badge.img+28
  • Superhero (Employee)
  • 1137 replies
  • December 4, 2023

Hey @ajayifs 

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

Cheers!


James Byrd
Sidekick (Employee)
Forum|alt.badge.img+5
  • Sidekick (Employee)
  • 10 replies
  • February 26, 2024

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_result[@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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings