<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Interface - Process Model: The &amp;#39;On Success&amp;#39; variable is not displaying the final value of the variable</title><link>https://community.appian.com/discussions/f/process/34630/interface---process-model-the-on-success-variable-is-not-displaying-the-final-value-of-the-variable</link><description>Hi everyone! 
 I am facing the following issue: I have a toggle button that activates a startProcess!, which is a Process Model designed to update the dates of a list of tasks. This list can contain more than 100 tasks which should be analyzed one by</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133089?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2024 14:48:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1b4611e9-2890-45f3-8ad0-0b6f03cb0399</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Instead of looping back over the two script tasks over and over, and each time using the &amp;quot;append to list&amp;quot; function, I posit that you could perform the looping in each script task (there would still be 2 script tasks but each of them would do all loops in one step).&amp;nbsp; The only way this wouldn&amp;#39;t work very well is if each loop relies on the reult of the previous loop somehow, which you aren&amp;#39;t very clear about (this isn&amp;#39;t a very common constraint).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133088?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2024 14:26:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0966fc6e-896f-41a2-8f9f-96944cc38a50</guid><dc:creator>Harsh Kumar Agarwal</dc:creator><description>&lt;p&gt;After going through the problem statement looks like you have a process with defined logic to take 100 tasks as input and return 100 modified tasks as output after writing in DB.&lt;br /&gt;If the above problem statement is correct and you do not need primary key of task 1 to define logic for task 2 then can you divide it as follows:&lt;/p&gt;
&lt;p&gt;1. Do the logic of task modification in SAIL as you already have it.&lt;br /&gt;2. Use an asynchronous process call to write it in DB.&lt;/p&gt;
&lt;p&gt;This way you will get the modified tasks same time and it will write it in DB in a separate call.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133078?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2024 12:49:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7e79aa3e-8870-4fba-bd9b-f9f11b8bfc26</guid><dc:creator>yahairat</dc:creator><description>&lt;p&gt;Sure, in the &amp;quot;Update each Task&amp;quot; process, I input each Task from the array tasksToUpdate using its index (tasksToUpdate,pv!index, null). Then, I send this input to the expression that generates the new date. The updated task is then appended to the modifiedTasks array. In the &amp;#39;Update dependents&amp;#39; process, all dependents of the task being analyzed in this loop should be modified to reflect the new updated date. This loop continues until all tasks have been analyzed. Initially, I attempted to implement a recursive rule expression, but it was not possible because I needed the newly updated date to affect the dependents, and saving was not feasible due to the immutability of variables in the foreach loop.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/14/pastedimage1712753963333v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133072?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2024 12:19:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6e6f0f64-de32-406f-84d2-e1f3436299d6</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="234900" url="~/discussions/f/process/34630/interface---process-model-the-on-success-variable-is-not-displaying-the-final-value-of-the-variable/133045"]Just to confirm, is there any way to obtain the final variable from the process model[/quote]
&lt;p&gt;If you were able to refactor the process model to avoid that loop (i.e. do the looping internally in a script task in a single epxression rule, if possible), then you&amp;#39;d probably get the final PV value returned at your calling interface.&lt;/p&gt;
&lt;p&gt;Can you share anything more about what&amp;#39;s happening inside the two looping nodes?&amp;nbsp; Often (though maybe not always) a loop like this can potentially be replaced with an expression rule that handles necessary looping via an a!forEach() call, etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133045?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 23:33:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:109f0d3f-2e97-47c8-8b2c-932e24f7f08a</guid><dc:creator>yahairat</dc:creator><description>&lt;p&gt;Thank you for your recommendation. Just to confirm, is there any way to obtain the final variable from the process model, isn&amp;#39;t there?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133044?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 21:39:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:116cf902-f6f8-46b6-aa5c-d3feeec029fc</guid><dc:creator>Dan Lluhi</dc:creator><description>&lt;p&gt;It looks like those are two script tasks to update the tasks/dependents, and then an XOR to iterate through your list. Are you able to redesign this to be a single script task that uses a!forEach instead? That is generally preferred over looping in a process model when possible, and in your case will avoid hitting the node chaining limit.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133043?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 21:10:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f1a141f7-2865-421c-828a-f3f2f3946e3f</guid><dc:creator>yahairat</dc:creator><description>&lt;p&gt;Thank you. Well, the iterative loop is inside the red square. Here, all the tasks that need to be updated are analyzed. Tasks will have their start dates updated to the next workday after their last dependency&amp;rsquo;s end date. No, I am not working with a database because it&amp;#39;s only a preview. After the user decides they are satisfied with the new order or the tasks, there is another button, with another process model, that updates all dates in the database.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/14/Screen-Shot-2024_2D00_04_2D00_09-at-4.09.04-PM.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133039?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 20:53:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9a701f4a-084b-4bb1-b1e6-83bda425435d</guid><dc:creator>Dan Lluhi</dc:creator><description>&lt;p&gt;Thanks for the extra context here and on your other reply - what Smart Services are you using within your process model to update the task? A screenshot could also help. Are these Appian tasks or some kind of DB-driven tasks? If this is a strict requirement for your front-end design then the best way to address this will be to redesign the process model to avoid looping.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133038?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 20:38:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:336b7495-1ff4-42fa-84fc-c8a493bcf0af</guid><dc:creator>yahairat</dc:creator><description>&lt;p&gt;&lt;span&gt;Well, it&amp;#39;s a functionality for creating a Gantt chart in which you&amp;nbsp;display up to&amp;nbsp;100 tasks. The toggle button activates a preview that updates the start date of the tasks to a working day ahead, and also manages the concept of dependencies: Task 1 starts on Monday and ends on Tuesday, Task 2, which depends on Task 1, should start on&amp;nbsp;Wednesday&amp;nbsp;and end on Thursday, Task 3, which depends on Task 2, starts on Friday and ends on Monday and of course it enters the loop because if there are more dependencies below, for example Task 5, which depends on Task 2, it should take the updated date from Task 2. Recursion was attempted but there was a performance problem, and now we have this limitation of the 50 nodes. Is the any advise for this?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133037?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 20:29:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a55acb71-3616-4b35-9480-c566c8e3cf97</guid><dc:creator>yahairat</dc:creator><description>&lt;p&gt;Certainly, I have the following variables: local!tasks (all Tasks that need to be analyzed - 100 Tasks), local!modifiedTasks (tasks with new dates, should be 100 Tasks):&lt;/p&gt;
&lt;p&gt;This is inside the toggle button:&lt;/p&gt;
&lt;p&gt;a!startProcess(&lt;br /&gt; processModel: cons!PROCESS_MODEL,&lt;br /&gt; processParameters: {&lt;br /&gt; initialTasks: local!tasks,&lt;br /&gt; },&lt;br /&gt; onSuccess: {&lt;br /&gt; a!save(&lt;br /&gt; local!modifiedTasks,&lt;br /&gt; fv!processInfo.pv.modifiedTasks&lt;br /&gt; ),&lt;br /&gt; }&lt;br /&gt; )&lt;/p&gt;
&lt;p&gt;What I am seeing are 15 tasks, but what I am expecting is 100 tasks.&lt;/p&gt;
&lt;p&gt;In the process model, I could observe in the &amp;#39;modifiedTasks&amp;#39; variables: 100 tasks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133036?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 20:25:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:25d4af67-980c-4206-a58f-2c981c0dbb09</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Echoing Dan&amp;#39;s reply - this feature isn&amp;#39;t really meant for situations where massive chaining / looping is happening.&amp;nbsp; Any chaining effect will break after the 50th flow connector, so the best approach would be to design around this in such a way that it isn&amp;#39;t critical to get the final value passed back into your interface, if you have to perform hundreds of loops in-process.&amp;nbsp; Can you share a bit more detail around your use case / what you&amp;#39;re trying to accomplish in general, that this is required?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interface - Process Model: The 'On Success' variable is not displaying the final value of the variable</title><link>https://community.appian.com/thread/133035?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 20:14:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:555c58c9-8b27-4f5f-9314-a1a35fa6c580</guid><dc:creator>Dan Lluhi</dc:creator><description>&lt;p&gt;Can you provide more detail on what you are seeing vs. expecting from the onSuccess saves, and/or share your code? If you are exceeding the activity chaining limit then that is likely your issue (from the &lt;a href="https://docs.appian.com/suite/help/24.1/Start_Process_Smart_Service.html#parameters"&gt;a!startProcess docs&lt;/a&gt; &amp;quot;...&lt;span&gt;and the values of process variables (such as fv!processInfo.pv.employeeId) once &lt;strong&gt;all initial activity-chaining is complete&lt;/strong&gt;&amp;quot;). If possible it would be best to avoid chaining through so many nodes.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>