Add sync entities to the app
@Overridesettings {errorhandling Server;pinauthentication Enabled;gpstracking Enabled;multidevice Enabled;}
@Override
syncentities {
entity CPartOrder {
offlinewhere = "Objstate in ('Planned', 'Released', 'Completed')";
transactiongroup = "C Part Order:${PartOrderId}";
syncpolicy Batch {
syncschedule = daily at 00:00;
}
}
entity CPartOrderLine {
transactiongroup = "C Part Order Line:${PartOrderId}-${LineNo}";
syncpolicy Batch {
syncschedule = daily at 00:00;
}
}}
Transaction Grouping:
Transaction Grouping is used in Failed Transaction handling to only block transactions from a single business object when a failure occurs rather than blocking all transactions from the User/Device/Application.
Sync Policies:
There are 3 sync policies you can use in your entity.
Batch - Batch entities are synchronized on a schedule and processed by a Database Task. The Synchronization Rules are created with a default schedule, but this can be overridden by using the command Edit Sync Rules.
Push and Batch - Push and Batch entities are synchronized in a similar way to Batch entities with an addition of pushing data changes to the users.
Grouped Push - Grouped Push entities are used to synchronize the same set of data to a group of users. The data is collected the first time a user within a group connects with the mobile app. When another user within the same group connects the collected data is synchronized to the user (plus any subsequent changes to the collected data).
Customize core client/projection files
projection ServiceEngApp;
component MWO;
layer Cust;
capability Offline;category Users, NativeMobile;
client ServiceEngApp;
component MWO;
layer Cust;
description "Put some useful description here ...";target AurenaNative;
variable StateOnline;call GetCurrentClient() into StateOnline;
if[StateOnline = "OFFLINE"] {//Mobile}if[StateOnline = "ONLINE"] {//IFS Cloud}
Offline File
@Overtake Coreprocedure Function<CGetAssiginedPartOrderLines> List<Structure(CPartOrderLine)> {parameter PartOrderId Number;parameter Result List<Structure(CPartOrderLine)>;variable CPartOrderLineRec Structure(CPartOrderLine);execute {for CPartOrderLineSet l where [l.PartOrderId = PartOrderId] into CPartOrderLineRec {call List.Add(Result, CPartOrderLineRec);}return Result;}}
procedure Function<CCountPartOrders> Number {variable Result Number;variable CPartOrderRec Structure(CPartOrder);variable Orders List<Structure(CPartOrder)>;execute {for CPartOrderSet l into CPartOrderRec {call List.Add(Orders, CPartOrderRec);}call List.Count(Orders) into Result;return Result;}}
@Override
procedure Action<CPartOrder.SetReleased> {
execute {
super(Record);
performAction;
set Record.Objstate = "Released";
saveLocal Record;
}
}
@Overtake Coreprocedure Action<CSaveRecord> Number {parameter Description Text;parameter Contract Text;parameter Destination Text;parameter CustomerNo Text;parameter ServiceObject Text;parameter Priority Text;parameter InternalNotes Text;parameter Address Text;parameter CreatedBy Text;parameter CreatedDate Timestamp;parameter Result Number;variable MaxId Number;variable CPartOrderRec Structure(CPartOrder);execute {fetch CPartOrderSet orderby [PartOrderId desc] into CPartOrderRec;set MaxId = [CPartOrderRec.PartOrderId+1];set CPartOrderRec = null;create CPartOrderRec;set CPartOrderRec.PartOrderId = MaxId;set CPartOrderRec.Description = Description;set CPartOrderRec.Contract = Contract;set CPartOrderRec.Destination = Destination;set CPartOrderRec.CustomerNo = CustomerNo;set CPartOrderRec.ServiceObject = ServiceObject;set CPartOrderRec.Priority = Priority;set CPartOrderRec.InternalNotes = InternalNotes;set CPartOrderRec.Address = Address;set CPartOrderRec.CreatedBy = CreatedBy;set CPartOrderRec.CreatedDate = CreatedDate;set CPartOrderRec.Objstate = "Planned";saveAndSend CPartOrderRec;set Result = MaxId;return Result;}}
@Overtake Coreprocedure Action<CRemoveLine> {parameter PartOrderId Number;parameter LineNo Number;variable CPartOrderLineRec Structure(CPartOrderLine);execute {for CPartOrderLineSet l where [l.PartOrderId = PartOrderId and l.LineNo = LineNo] into CPartOrderLineRec {deleteAndSend CPartOrderLineRec;}}}
0 Comments