Skip to main content

Posts

Showing posts from February, 2022

Retrieve, Associate, Disassociate N:N Related Records using C#

 URL retrieve QueryExpression query = new QueryExpression("list"); //Name of the entity to be passed whose records need to be retrieved var nIsToNRelationshipName="cdi_emailsend_suppressed_list"; //schema name of N:N relationship query.ColumnSet = new ColumnSet(true); var link = query.AddLink(nIsToNRelationshipName, "listid", "listid"); //Method Signature: AddLink("N:N schema name to be passed", "Primary key ID schema name of entity record to be retrieved", "schema name of attribute in the N:N relationship") Guid emailSendID = new Guid("79121c07-220e-41ae-9710-96b880973e6c"); //sample ID of Email Send record for which we are retrieving related records link.LinkCriteria = new FilterExpression() { Conditions = { new ConditionExpression("cdi_emailsendid", ConditionOperator.Equal, emailSendID) // Filter condition to get related marketing lists of an Email Send record } };   EntityCollection collRecord

How to call Web API and Get Data from dataverse in Power Apps Portal

Hi, the following is the steps to set up web API for Portal   1.) Enable Web API for a particular Table that you want to access by creating a site setting   eg- 2.) specify which field you want to access by this site setting eg- 3.) create Table Permission for the table, set  Privileges, and set  Web Roles eg- 4.)Use the following code to access data  var deferredAjax = $ . Deferred ();     var ajaxOptions ;     shell . getTokenDeferred (). done ( function ( token ){         debugger ;         alert ( "pass" )       ajaxOptions = {         type: "GET" ,         url: "/_api/msdyn_functionallocations?$select=msdyn_name&$filter=_trbdn_customerid_value eq XXXXXXXX-xxxx-xxxx-xxxx-xxxxxxxxxxxx and statecode eq 0" ,         contentType: "application/json" ,         headers: { "__RequestVerificationToken" : token }       };       // ajaxOptions.headers["__RequestVerificationToken"] = token;         $ . ajax ( ajaxOptions ).