I have this workflow in my application where the user will set a work order. On this work order, the user can now then assign another multiple job orders. The work order serves as the title or parent while the job orders are the different jobs inside the work order. I have no problem on setting allocated tables and datapages for this.
The issue is, sometimes, there are new work orders where they just similar to an old work order. So after creating this new work order, you also have to recreate the children of this work order. This can become quite troublesome and annoying because some work orders have 5, 10's or even hundreds of childs and its a lot of work to manually recreate them.
Therefore, I would like to share this solution with you which I achieve by using triggered actions.
first, on my "work_order" table, I added a text field named "work_order_id_origin"
second, on my submission form for my work orders, I included this field and set its form element as a drop-down. I assign my work order table as its look up table, this now displays the different titles of work orders but has the value of their work_order_id. Make sure to add a blank value to your dropdown so you can still record new work orders.
The reason for this dropdown is for the user to select which previous work orders is this new work order is similar.
Then on trigger action, The trigger will now check if the value on this field is equal to any id value on work order tables. If it found a match. You will have to use a "IF THEN" block which has the condition of "Select top 1 from #inserted" which contains value of "#inserted.work_id_origin" Then use 'in' logical operator then use the query statement "Selec From Work_order_table" which contains the value of "work_order_id". This trigger block is the checker if the desired work order is a copy from previous record or a new one.
On "THEN" part of this conditional statement, You will simply have to use an "Insert Into" where block select from "Job_order_table" where its "parent work_order_id" is equal to #inserted's "work_order_origin table". Then reinsert all of those record again with in the same table but this time, with different parent ID.
You may also change some other field values with this upon re-insert. Hope It helps.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
NiceDuck
Hello everyone,
I would like to share a trigger workflow again.
I have this workflow in my application where the user will set a work order. On this work order, the user can now then assign another multiple job orders. The work order serves as the title or parent while the job orders are the different jobs inside the work order. I have no problem on setting allocated tables and datapages for this.
The issue is, sometimes, there are new work orders where they just similar to an old work order. So after creating this new work order, you also have to recreate the children of this work order. This can become quite troublesome and annoying because some work orders have 5, 10's or even hundreds of childs and its a lot of work to manually recreate them.
Therefore, I would like to share this solution with you which I achieve by using triggered actions.
first, on my "work_order" table, I added a text field named "work_order_id_origin"
second, on my submission form for my work orders, I included this field and set its form element as a drop-down. I assign my work order table as its look up table, this now displays the different titles of work orders but has the value of their work_order_id. Make sure to add a blank value to your dropdown so you can still record new work orders.
The reason for this dropdown is for the user to select which previous work orders is this new work order is similar.
Then on trigger action, The trigger will now check if the value on this field is equal to any id value on work order tables. If it found a match. You will have to use a "IF THEN" block which has the condition of "Select top 1 from #inserted" which contains value of "#inserted.work_id_origin" Then use 'in' logical operator then use the query statement "Selec From Work_order_table" which contains the value of "work_order_id". This trigger block is the checker if the desired work order is a copy from previous record or a new one.
On "THEN" part of this conditional statement, You will simply have to use an "Insert Into" where block select from "Job_order_table" where its "parent work_order_id" is equal to #inserted's "work_order_origin table". Then reinsert all of those record again with in the same table but this time, with different parent ID.
You may also change some other field values with this upon re-insert. Hope It helps.
QUACK
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.