So when we set up a promotion sometimes we need to add new items to the TPM and in order for that item to be added we need to change the TPM to InProcess and then back to CustomerApproved so that the promotion can now include the new item. I was able to write some code to update a single TPM but cannot figure out how i could have this job change the status from InProcess to CustomerApproved in the same instance. A problem i run into is that since it take a while for it to change from InProcess to CustomerApproved there has to be something to wait for that to finish before changing it back to CustomerApproved. Here is the code i have so far.... Static void RebateStatusUpdate(Args _args) { jsTPMTradePromotion jsRebates; jsTPMStatus jsStatus; jsPromotionID jsID; while select for update jsRebates where jsRebates.PromotionID == 'TPM-0000374' { ttsBegin; jsRebates.jsPromotionStatus = jsTPMStatus::CustomerApproved; jsRebates.update(); ttsCommit; inf("TPM Updated") } }
↧