Start a new topic
Answered

Parallel steppers / workflows

Consider the follow scenario:

User A starts a stepper for authoring a car and changes color from red to black. However, the user does not finish the edit. Instead it is saved until later.

Meanwhile User B opens the same record in the same stepper and changes the color from red to grey and saves the data (completes the stepper)

When User A returns, he/she can happily complete the stepper. The GD value is changed to black without any error, notice or warning that someone else has updated the information in between.

Of course we could setup some kind of workaround that copies e.g. the load id from the originating golden record and then we create a validator for this, but we would of course want to avoid adding a custom solution like this for every workflow and stepper.

(these are all basic entities)


Best Answer

There is an existing enhancement request 'Display concurrent change indicator in browsing' in which you can mention the customer that is asking for this.

The workaround you mention is a good one.

Another way to do this is to add an indicator to show that the record is currently being edited.

It will call a custom procedure like this:

/* Return a comma separated list of users that are currently editing this record */

/* PostgreSQL */
create or replace function usr_get_change_indicator(p_id numeric)
 RETURNS text
 LANGUAGE plpgsql
AS $function$
declare 
  ret text;
begin

    select string_agg( b.b_loadcreator || ' (' || b.b_loadid || ')', ', ' order by b.b_loadid ) into ret
    from 
        sa_my_entity me
        inner join dl_batch b on b.b_loadid = me.b_loadid
    where me.id = p_id
    and b.b_status = 'RUNNING';

  return ret;
end
$function$
;

/* Oracle equivalent */
select LISTAGG(D.B_LOADCREATOR || ' (' || D.B_LOADID || ')' , ', ') within group (order by D.B_LOADID)
   from  
       SA_PRODUCT P
       inner join DL_BATCH D on P.B_LOADID = D.B_LOADID
   where P.ID = &p_id
   and D.B_STATUS = 'RUNNING';


It displays in a collection column where the id of the record being changed is passed to the procedure, so the indicator can warn that the record is being edited by another user.

Note: displaying this in the collection is sufficient for many use cases. But you can got a step further and add a Condition on the Edit Action Configuration using a call to the same function to really prevent a second user from editing the record.


Answer

There is an existing enhancement request 'Display concurrent change indicator in browsing' in which you can mention the customer that is asking for this.

The workaround you mention is a good one.

Another way to do this is to add an indicator to show that the record is currently being edited.

It will call a custom procedure like this:

/* Return a comma separated list of users that are currently editing this record */

/* PostgreSQL */
create or replace function usr_get_change_indicator(p_id numeric)
 RETURNS text
 LANGUAGE plpgsql
AS $function$
declare 
  ret text;
begin

    select string_agg( b.b_loadcreator || ' (' || b.b_loadid || ')', ', ' order by b.b_loadid ) into ret
    from 
        sa_my_entity me
        inner join dl_batch b on b.b_loadid = me.b_loadid
    where me.id = p_id
    and b.b_status = 'RUNNING';

  return ret;
end
$function$
;

/* Oracle equivalent */
select LISTAGG(D.B_LOADCREATOR || ' (' || D.B_LOADID || ')' , ', ') within group (order by D.B_LOADID)
   from  
       SA_PRODUCT P
       inner join DL_BATCH D on P.B_LOADID = D.B_LOADID
   where P.ID = &p_id
   and D.B_STATUS = 'RUNNING';


It displays in a collection column where the id of the record being changed is passed to the procedure, so the indicator can warn that the record is being edited by another user.

Note: displaying this in the collection is sufficient for many use cases. But you can got a step further and add a Condition on the Edit Action Configuration using a call to the same function to really prevent a second user from editing the record.

Hi Subham.


Is it possible to achieve the same result presented above but with the new data-driven workflows? Per my understanding workflow executions are not stored in the dl_batch and sa_ tables so I guess that the data needs top be retrieved somewhere else.

Hello Sebastian,


I have seen that the new gen workflow executions are stored in DL_BATCH but not in the sa_tables, so it might not possible in the new gen workflows.


Thanks

Login to post a comment