How to prevent import from updating status on a record.

Posted by Paulh0763 on 11-Mar-2015 11:16

I have a client who imports order twice a day and the orders that are cancelled and locked get changed to shipped and remain locked. I was thinking a validation trigger or something I can use with a condition to prevent only these records from changing? I was thinking something like 

if(rbv_api.isImport() && '{!status#id#before}' == '3986115'){
rbv_api.setFieldValue("poster_order", {!id}, "status", "Cancelled")
return "Cancelled"
}else{
return "{!status#value}"
}

Not sure if I am accurate with my code??

Any input is appreciated thanks.

All Replies

Posted by cohezive on 11-Mar-2015 17:37

Is there a reason you cannot use an Import Map that simply does not map the Status field ("Not Mapped")?

Posted by Paulh0763 on 12-Mar-2015 06:51

I apologize they do use an import map and the status field has to be mapped. If an order is cancelled it, a cancellation date field is populated with a trigger and it gets locked, so users cannot modify it. They import orders twice a day that have shipped with tracking information, and I believe it changes status of the cancelled/locked orders to shipped. As a result, this gives a false record to their clientele because when they log into their portal they see shipped orders, with a cancellation date, and the record is locked. I was thinking maybe create a delayed trigger that would change the orders back to cancelled if possible?

Posted by Gian Torralba on 12-Mar-2015 10:23

Hello,

What value are you mapping the status field with? If there is no code that will update the status field, it should remain the same with the imported file.

Thank you,
Gian

Posted by Paulh0763 on 18-Mar-2015 09:57

Sorry for the late reply. The importing is an automated process and done twice a day. The status field value is "Shipped" (on the mapping) and orders that have been Cancelled prior to the automation of the import get changed from Cancelled to Shipped. So...the orders are locked, have a cancellation date, and the status is now Shipped. My client is trying to prevent this from occurring and as I have explained to them if you are mapping that field it will change regardless. So this is why I am trying to figure out a way to revert that status field back to Cancelled after the import. And everything I have tired does not work. Suggestions are appreciated! :)

Posted by Gian Torralba on 18-Mar-2015 10:06

Hello,

Can you not select a value in the mapping setup page? So it won't override any values in the import file?

Thank you,

Gian

Posted by Paulh0763 on 18-Mar-2015 11:28

No because then the orders would not change to Shipped. The import is automated.

Thanks, Paul

Posted by Gian Torralba on 20-Mar-2015 10:42

Hello,

In the excel file, you can set the cell value as Shipped so that you will not set the value on the data map to Shipped. This won't override any values set in the excel file.

Thank you,
Gian

This thread is closed