By Region

Suppose you want to search records within a specified region. For this, we have created the custom action with name “Inogic.Maplytics.API.Region” (ikl_InogicMaplyticsAPIRegion). Custom action accepts the following parameters.

  • RegionType: Provide the type of region based on which user wants to search. , i.e., City, State, County, Country, PostalCode, PostCode Sector, PostCode(Outward Code), PostalCode Areas “City/Postalcode/State”. You need to provide any of the above.

  • Region: Provide the region where you need to search. E.g., New York.

  • Entity: Specify the entity name. e.g., “Account".

  • ViewName: Specify the view name. e.g., “My active accounts”.

When user passes the required parameters and executes this action then the action will return records collection.

To execute region action using the C#, use following code.

string requestName = "ikl_InogicMaplyticsAPIRegion";

                    //create request object
                    OrganizationRequest orgReq = new OrganizationRequest(requestName);                   

                    //for region
                    orgReq["RegionType"] = "city";
                    orgReq["Region"] = "New york";

                    //Entity & view
                    orgReq["Entity"] = "account";
                    orgReq["ViewName"] = "My Active Accounts";

                    OrganizationResponse response = service.Execute(orgReq);

                    EntityCollection recordsCollection = (EntityCollection)response.Results["RecordsCollection"];

To execute the action using the javascript (web api) you can use following code.

var actionObj = {
             RegionType: "City",
             Region: "New York",
             Entity: "account",
             ViewName: "My Active Accounts",

         // call this function to execute the action 
         execute(actionObj, "ikl_InogicMaplyticsAPIRegion()", function (data) {

              alert("Success: " + data);

         }, function (error) {
             alert("Error: " + error.message);

Last updated