Skip to main content
Question

How To - Update/Assign Date & Time split field value while importing Sales Order from Shopify to Acumatica using Shopify Connector

  • September 13, 2023
  • 1 reply
  • 91 views

Hi Team,

We are working with Shopify connector (build: 21.224) to import Shopify Orders into Acumatica. We have a date field that we want to update with Shopify order created date time. This field is split on the UI as Date and Time part but is a single field only. We tried like below but the field value is not updating. Can you please review below details and suggest the best possible way to do that.

 

DAC: 

 #region UsrKNSPSBOrderPlacedTimeStamp
        [PXDBDateAndTime(PreserveTime = true)]
        [PXUIField(DisplayName = "Placed Datetime")]
        public DateTime? UsrKNSPSBOrderPlacedTimeStamp { get; set; }
        public abstract class usrKNSPSBOrderPlacedTimeStamp : PX.Data.BQL.BqlDateTime.Field<usrKNSPSBOrderPlacedTimeStamp> { }
        #endregion

Graph:

public class KNSPSBSalesOrderProcessorExt : PXGraphExtension<SPSalesOrderProcessor>
    {
        public static bool IsActive() { return true; }        

        public delegate void MapBucketImportDelegate(SPSalesOrderBucket bucket, IMappedEntity existing);
        [PXOverride]
        public void MapBucketImport(SPSalesOrderBucket bucket, IMappedEntity existing, MapBucketImportDelegate baseMethod)
        {
            baseMethod(bucket, existing);
            MappedOrder obj = bucket.Order;            
            OrderData data = obj.Extern;
            SalesOrder impl = obj.Local;
            DateTime? orderCreatedAt = data.DateCreatedAt;            
            impl.Custom = new PX.Api.ContractBased.Models.CustomField[]
                     {
                            new CustomDateTimeField()
                            {
                                 ViewName = "CurrentDocument",
                                 FieldName = "UsrKNSPSBOrderPlacedTimeStamp",
                                 Value = orderCreatedAt.ValueField()
                            }
                     }.ToList();
        }
    }

Aspx:

<px:PXDateTimeEdit runat="server" ID="CstPXDateTimeEdit1" CommitChanges="True" DataField="UsrKNSPSBOrderPlacedTimeStamp_Date" />
                            <px:PXDateTimeEdit runat="server" ID="PXDateTimeEdit1" EditFormat="g" DisplayFormat="g" TimeMode="True" SuppressLabel="True" CommitChanges="True" DataField="UsrKNSPSBOrderPlacedTimeStamp_Time" />

 

Thank you in Advance!

1 reply

Forum|alt.badge.img+1

Hi, I think this would be helpful. Use your DAC something like this. 

#region StartTime
 [PXDBDateAndTime(UseTimeZone = true, DisplayNameDate = "Date", DisplayNameTime = "Time")]
 [PXUIField(DisplayName = "Time", Enabled = false)]

 public virtual DateTime? Time { get; set; }
 public abstract class time : PX.Data.BQL.BqlDateTime.Field<time> { }
#endregion

You can set both date and time at once. 

And then you can show it in two separate fields in the UI.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings