Do change data workflow trigger for virtual columns

Can a change in a virtual column trigger a data change workflow for a real back end column?

Solved Solved
0 13 680
1 ACCEPTED SOLUTION

  1. I think you can/should do away with the virtual column, and make Classification a real column.

  2. Create an action for the Customers table of type Data: set the values of some columns in this row that recomputes the rowโ€™s Classification column value.

  3. Create an action for the Leads table of type Data: execute an action on a set of rows with a referenced table of Customers, a referenced rows of LIST([Customer]), a referenced action of the Customers table action in (2) above, and a condition expression that checks those two criteria you mention.

  4. Attach that Leads table action from (3) to the Form Saved event action in whatever Leads table form users use to change the Stage column.

  5. And/or attach the action from (3) to any other actions that modify the Leads table.

  6. Alternatively, donโ€™t do (4) and/or (5), but instead attach the action from (3) to a workflow that monitors for changes in Leads.

View solution in original post

13 REPLIES 13

Steve
Platinum 4
Platinum 4

Nope, only changes to non-virtual columns.

Then can you help me with this?

I want to change a status based on change in a column called [classification] which is virtual. The column and workflow change is related to a table called โ€œCustomersโ€

The formula of the [Classification] column:

ifs(
and([Current Stage]=โ€œLostโ€, IN(โ€œJob Soldโ€, select(Leads[Stage], [Customer]=[_THISROW]))=FALSE), โ€œInactive Prospectโ€,
and([Current Stage]=โ€œLostโ€, IN(โ€œJob Soldโ€, select(Leads[Stage], [Customer]=[_THISROW]))), โ€œInactive Customerโ€,
and([Current Stage]<>โ€œLostโ€, IN(โ€œJob Soldโ€, select(Leads[Stage], [Customer]=[_THISROW]))=FALSE), โ€œActive Prospectโ€,
and([Current Stage]<>โ€œLostโ€, IN(โ€œJob Soldโ€, select(Leads[Stage], [Customer]=[_THISROW]))), โ€œActive Customerโ€
)

The [Current stage] is a dereference.

[Current Stage]=[Key of current stage in leads].[Stage]

[Key of current stage in leads] = MAXROW(โ€œLeadsโ€, โ€œ_ROWNUMBERโ€, ([Customer]=[_THISROW]))


The [Key of current stage] selects that row in the โ€˜leadsโ€™ table which is the last record for a customer. The [Current Stage] column calculates the corresponding [Stage] in the leads table.

The logic is:

  1. If the current stage is โ€˜lostโ€™ and one of the stage value in the lead history is โ€˜soldโ€™, then the classification is โ€œInactive Customerโ€.
  2. Current Stage <> Lost, and one of the stage values is โ€˜soldโ€™, then the classification = โ€œActive Customerโ€
  3. Current Stage = โ€œLostโ€, and not one of the stage values is โ€˜Soldโ€™, then classification = โ€œInactive Prospectโ€,
  4. Current stage <> Lost, and not one of the stage values is โ€˜Soldโ€™, then classification = โ€œActive prospectโ€

The stage values change by appropriate actions on pertinent occasions.

I have requirements such that the [Classification] column is turned into a real column which will change with data change of the [stage] column in leads table.

As of now I was trying to trigger the workflow by invoking the change based on the virtual column value, but it would not work, as pointed out by @Steve.

So I input one of the ifs condition directly into the change workflow condition.

and([Current Stage]=โ€œLostโ€, IN(โ€œJob Soldโ€, select(Leads[Stage], [Customer]=[_THISROW]))=FALSE)

Which is intended to turn the real column status to โ€œInactive Prospectโ€

But the [Current Stage] as I had defined, is a virtual column as a derference using another virtual column. Which should also not work. And it does not work. So the theory stands.

What I think would work here hypothetically is :

and([MAXROW(โ€œLeadsโ€, โ€œ_ROWNUMBERโ€, ([Customer]=[_THISROW]))].[Stage]="Lost", IN(โ€œJob Soldโ€, select(Leads[Stage], [Customer]=[_THISROW]))=FALSE)

But I cant happen to make the block [MAXROW(โ€œLeadsโ€, โ€œ_ROWNUMBERโ€, ([Customer]=[_THISROW]))].[Stage]="Lost" work. I want to directly calculate the dereference. But this particular formula is not allowing currently.

PLEASE HELP. I hope this was not too big. But I had to lay out all the pertinent information.

Reformatted:

IFS(
  AND(
    ([Current Stage] = โ€œLostโ€),
    IN(
      โ€œJob Soldโ€,
      SELECT(
        Leads[Stage],
        ([Customer] = [_THISROW])
      )
    )
    = FALSE
  ),
    โ€œInactive Prospectโ€,
  AND(
    ([Current Stage] = โ€œLostโ€),
    IN(
      โ€œJob Soldโ€,
      SELECT(
        Leads[Stage],
        ([Customer] = [_THISROW])
      )
    )
  ),
    โ€œInactive Customerโ€,
  AND(
    ([Current Stage] <> โ€œLostโ€),
    IN(
      โ€œJob Soldโ€,
      SELECT(
        Leads[Stage],
        ([Customer] = [_THISROW])
      )
    )
    =FALSE
  ),
    โ€œActive Prospectโ€,
  AND(
    ([Current Stage] <> โ€œLostโ€),
    IN(
      โ€œJob Soldโ€,
      SELECT(
        Leads[Stage],
        ([Customer] = [_THISROW])
      )
    )
  ),
    โ€œActive Customerโ€
)

Simplified:

IF(
  ([Current Stage] = โ€œLostโ€),
  IF(
    IN(
      โ€œJob Soldโ€,
      SELECT(
        Leads[Stage],
        ([Customer] = [_THISROW])
      )
    ),
    โ€œInactive Customerโ€,
    โ€œInactive Prospectโ€
  ),
  IF(
    IN(
      โ€œJob Soldโ€,
      SELECT(
        Leads[Stage],
        ([Customer] = [_THISROW])
      )
    ),
    โ€œActive Customerโ€,
    โ€œActive Prospectโ€
  )
)

Or even:

IF(
  IN(
    โ€œJob Soldโ€,
    SELECT(
      Leads[Stage],
      ([Customer] = [_THISROW])
    )
  ),
  IF(
    ([Current Stage] = โ€œLostโ€),
    โ€œInactive Customerโ€,
    โ€œInactive Prospectโ€
  ),
  IF(
    ([Current Stage] = โ€œLostโ€),
    โ€œActive Prospectโ€,
    โ€œActive Customerโ€
  )
)

Okay, but would this solve what Iโ€™m ultimately trying to achieve?

Nope, but I need to understand what that expression was doing, and thought Iโ€™d share my observations.

So when a rowโ€™s stage column value changes, the Classification column values that are based that particular rowโ€™s stage column value need to be updated?

Classification column and stage column are from different tables - customers and leads respectively.

The lead has a ref to the customers table, since leads are entered against the customers.

When the Leads tableโ€™s [stage] value changes, that should update the [classification] column in the customers table. Though [classification] is a virtual column calculated from the above mentioned formula. It gets updated real time.

But what Iโ€™m specifically requested is to have the changes incorporated in a real backend column, say [Status], for the customers table. One thing that I should have mentioned that the [Status] column is of initial value โ€œActive Prospectโ€

So the user or some other in-app process updates a Leads row with a new Stage column value. The Leads row references a single Customers table row via Customer. That referenced Customers row needs to be updated so its Classification column value is recalculated to reflect the new Stage column value in the Leads row. Yes?

Yes.

But its based on two criteria.

  1. The value of the stage column in the latest lead for the customer.
  2. Whether or not the stage โ€œJob soldโ€ occurs at least once in the lead history for the customer.

  1. I think you can/should do away with the virtual column, and make Classification a real column.

  2. Create an action for the Customers table of type Data: set the values of some columns in this row that recomputes the rowโ€™s Classification column value.

  3. Create an action for the Leads table of type Data: execute an action on a set of rows with a referenced table of Customers, a referenced rows of LIST([Customer]), a referenced action of the Customers table action in (2) above, and a condition expression that checks those two criteria you mention.

  4. Attach that Leads table action from (3) to the Form Saved event action in whatever Leads table form users use to change the Stage column.

  5. And/or attach the action from (3) to any other actions that modify the Leads table.

  6. Alternatively, donโ€™t do (4) and/or (5), but instead attach the action from (3) to a workflow that monitors for changes in Leads.

The two criteria that I mentioned can output 2 x 2 = 4 different conditions of validation.

What you mentioned in (2), about recomputing the Classification column, it should be able to recompute to one of four values. (Active Prospect, Inactive Prospect, Actibe Customer, Inactive customer).

So do I need 4 different actions? But then, how would I attach 4 actions to a workflow?

Grouped action would not work in this case I think, since all actions are based on different values of the same condition operator

Not at all. One action that computes the value. The expression I reformatted and simplified above.

Thanks man. Youโ€™re a saviour

Top Labels in this Space