Skip to main content
Solved

Import Meta fields From BigCommerce To Acumatica


hi,

Is there a way to import metafields from BigCommerce  to Acumatica?

Best answer by smarenich

Hi @Shikha6831 

I have noticed 2 problems:

First

BCSalesOrderProcessor _processor = PXGraph.CreateInstance();

Please do not create a new graph, it will significantly slow down the performance, you can use instead

var client = BCConnector.GetRestClient(Base.GetBindingExt());

Second, you may need to pass some parameters to filter, I have noticed we are passing namespace and key to get metafields

orderMetaFieldDataProvider.GetAll(new FilterOrderMetaField { Key = BCObjectsConstants.ImportedInAcumatica, NameSpace = BCObjectsConstants.Namespace_Global }, syncstatus.ExternID).ToList()

Also please test metafields request with your store using postman or https://developer.bigcommerce.com/api-reference/b3A6MzU5MDQ4MzE-get-metafields.
For instance your token may not have access rights to metafields.

 

If you still get a NullReferenceExceltion, please add here stack trace of the error.

View original
Did this topic help you find an answer to your question?

8 replies

Kyle Vanderstoep
Jr Varsity III
Forum|alt.badge.img+1

Are you talking about importing metafield values or the metafield definitions?


smarenich
Acumatica Moderator
Forum|alt.badge.img+3
  • Acumatica Commerce Edition Team Lead
  • 227 replies
  • March 22, 2022

@Shikha6831 do you mean Order Metafields? https://developer.bigcommerce.com/api-reference/b3A6MzU5MDQ4MzE-get-metafields

Currently we don’t support it, but you can customize the connector to map it.


  • Author
  • Freshman II
  • 10 replies
  • March 23, 2022

@Kyle Vanderstoep  yes i am talking about importing metafield values.


  • Author
  • Freshman II
  • 10 replies
  • March 23, 2022

Hi @smarenich ,

 Yes we need to import Order Metafields. Could you please explain in brief how to do it?


smarenich
Acumatica Moderator
Forum|alt.badge.img+3
  • Acumatica Commerce Edition Team Lead
  • 227 replies
  • March 23, 2022

@Shikha6831 this example is very similar - 

The difference is, instead of modifiers you need to get metafields from BigCommerce.

Hope it helps.


  • Author
  • Freshman II
  • 10 replies
  • March 25, 2022

Hello,

I have tried to get order metafields using MapBucketImport function but there are no metafields returned, then i try to get through RestApi and it gives error "Object reference not set to an instance of an object." Could you please check my code what i am doing wrong..

public delegate void MapBucketImportDelegate(BCSalesOrderBucket bucket, IMappedEntity existing);
[PXOverride]
public void MapBucketImport(BCSalesOrderBucket bucket, IMappedEntity existing, MapBucketImportDelegate baseMethod)
{
baseMethod(bucket, existing);

MappedOrder obj = bucket.Order;
OrderData data = obj.Extern;
SalesOrder impl = obj.Local; 

BCSalesOrderProcessor _processor = PXGraph.CreateInstance();
 
var client = BCConnector.GetRestClient(_processor.GetBindingExt());

orderMetaFieldDataProvider = new OrderMetaFieldRestDataProvider(client);
data.MetaFields = orderMetaFieldDataProvider.GetAll(new FilterOrderMetaField { }, bucket.Order.ExternID).ToList() ?? new List();
if (data?.MetaFields != null)
{
   foreach (var option in data.MetaFields)

   {

   }
}
}


smarenich
Acumatica Moderator
Forum|alt.badge.img+3
  • Acumatica Commerce Edition Team Lead
  • 227 replies
  • Answer
  • March 26, 2022

Hi @Shikha6831 

I have noticed 2 problems:

First

BCSalesOrderProcessor _processor = PXGraph.CreateInstance();

Please do not create a new graph, it will significantly slow down the performance, you can use instead

var client = BCConnector.GetRestClient(Base.GetBindingExt());

Second, you may need to pass some parameters to filter, I have noticed we are passing namespace and key to get metafields

orderMetaFieldDataProvider.GetAll(new FilterOrderMetaField { Key = BCObjectsConstants.ImportedInAcumatica, NameSpace = BCObjectsConstants.Namespace_Global }, syncstatus.ExternID).ToList()

Also please test metafields request with your store using postman or https://developer.bigcommerce.com/api-reference/b3A6MzU5MDQ4MzE-get-metafields.
For instance your token may not have access rights to metafields.

 

If you still get a NullReferenceExceltion, please add here stack trace of the error.


  • Author
  • Freshman II
  • 10 replies
  • April 1, 2022

Hi,

Sorry for late reply. Thanks it worked :)


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