2025 Mar 17 5:45 PM - edited 2025 Mar 17 6:22 PM
Hi All,
I am trying to get data for audit before and after payload via below groovy script -
import de.hybris.platform.persistence.audit.gateway.AuditSearchQuery;
import de.hybris.platform.persistence.audit.gateway.AuditRecord;
import de.hybris.platform.servicelayer.search.FlexibleSearchQuery;
import java.util.stream.Collectors;
readAuditGateway = spring.getBean "readAuditGateway";
query = new FlexibleSearchQuery("select {o.pk} from {Order as o} where {o.code} = ‘00741074'");
searchService = spring.getBean "flexibleSearchService";
searchResult = searchService.search(query);
order = searchResult.getResult().get(0);
final AuditSearchQuery query = AuditSearchQuery.forType("Order").withPkSearchRules(order.getPk()).build();
final List<AuditRecord> results = readAuditGateway.search(query).collect(Collectors.toList());
println "Changing User " + " | " + "After Value";
results.each
{ result ->
println result.getChangingUser() + " | " + result.getAttributesBeforeOperation();
}
But unfortunately Sap commerce is returning only few fields / attributes via groovy -
Result:
Changing User | After Value
testing0101@mailinator.com | [date:Mon Mar 17 01:32:13 PDT 2025, contactnumber:53453455, totaltaxvaluesinternal:[], retryaddresssyncattempts:0, isorderrejectionemailsent:false, discountsincludepaymentcost:false, language:8796093055008, paymentinfo:8810053009450, paymentmode:8796093087785, salesapplication:Web, fulfillmenttype:ADI_FULFILLED, net:true, calculated:true, fraudulent:false, potentiallyfraudulent:false, deliverymode:8796097085480, paymentaddress:8820047282199, emailaddress:testing0101@mailinator.com, lastname:QA1, totaltax:0.0, unit:8807299776517, subtotal:10250.0, guid:3fc8abcc-855d-4e2d-87a2-0e877d9b3498, totaldiscounts:0.0, creationtime:Mon Mar 17 01:32:13 PDT 2025, deliveryaddress:8820047314967, status:SUBMITTED, ipaddress:20.12.107.80, firstname:ADGT, code:2000361786, deliveryblock:false, sapsalesorganization:8801041425516, issyncedtos4:true, paymentterm:NT30, locale:en, discountsincludedeliverycost:false, sapsystemtype:SAP_ERP, modifiedtime:Mon Mar 17 01:42:52 PDT 2025, migrationstatus:NA, isfreightcharged:false, currency:8796093120545, enduse:Building Control & Automation, telephonecountrycode:+93, globaldiscountvaluesinternal:[], paymentcost:0.0, totalprice:10250.0, store:8796093056989, deliverycost:0.0, site:8796093056040, itemtype:8796094169170, projectapplication:Building Technology, isorderconfirmationemailsent:false, retryordersyncattempts:0, pk:8823356325933, user:8809855680516, paymenttype:PAY_BY_TERM]
But if I am using SQL to get the same PK audit data, I can see all the fields / attributes -
SQL:
select * from orders45sn where itempk = 8823356325933
Result:
Can someone please help me understand if there is any hidden config related to JDBC or DB layer which is limiting it certain number of fields / attributes?
Or some issue in payloadDeserializer I am suspecting (Based on my debugging so far because raw payload has all the fields, after deserializer it's causing issue) -
Thanks,
Sumit
Request clarification before answering.
The groovy looks ok. Please check audit data config. May be we are keeping only last few entries or some x number of days data. Thats why you were not able to see all audit log data from the system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.