Issue when using Salesforce ConnectAPI.CommerceSearchSettings

1k Views Asked by At

I got requirement to recalculate B2B Webstore index programatically.

Found documentation here: https://developer.salesforce.com/docs/atlas.en-us.232.0.apexref.meta/apexref/apex_ConnectAPI_CommerceSearchSettings_static_methods.htm#apex_ConnectAPI_CommerceSearchSettings_postCommerceSearchIndex_2

But when trying to save class (API 52.0) :

public with sharing class B2B_SearchRecalculation { public static void recalculate() { ConnectApi.CommerceSearchIndex xyz = ConnectApi.CommerceSearchSettings.postCommerceSearchIndex('XYZ'); } }

I am getting an error:

B2B_SearchRecalculation.cls Method does not exist or incorrect signature: void postCommerceSearchIndex(String) from the type ConnectApi.CommerceSearchSettings (5:80)

Please support.

1

There are 1 best solutions below

1
Bartosz On
public with sharing class B2B_SearchRecalculation {
  public static void recalculate()
  {
    ConnectApi.CommerceSearchIndex xyz =
    ConnectApi.CommerceSearchSettings.createCommerceSearchIndex('webstoreid');
  }
}