cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

I added an extension field for sales quotes via sap cloud app studio which should not be copied. How can I achieve that this extension field will be empty when a quote is copied?

0 Likes
View Entire Topic
dominik_g
Participant

Hello Miriam,

1) add a field to the CustomerQuote BOX on the root node.

//BO Extension
element Z_CustomerQuoteUUID : UUID;

2) Fill the field in the root-Before-Save script with the root node UUID (additional checks are required to make sure that the instance is writable, i.e. not in Status "completed").

3) In root-After-Modify check if the field is different...

//Before Save
foreach(var obj in this) {
     if(obj.Z_CustomerQuoteUUID.content.IsInitial() && !obj.UUID.content.IsInitial()) {
          //todo: writable check
          obj.Z_CustomerQuoteUUID.content = obj.UUID.content;
     }
}


//After Modfiy
foreach(var obj in this) {
     if(!obj.Z_CustomerQuoteUUID.content.IsInitial() && obj.Z_CustomerQuoteUUID.content != obj.UUID.content) {
          //todo: writable check
          obj.Z_CustomerQuoteUUID.content = obj.UUID.content;
          
          //clear your copied extension field here
     }
}