GithubHelp home page GithubHelp logo

test-mass-forker-org-1 / dynamics-365-relationshipassistant-extensibility Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/dynamics-365-relationshipassistant-extensibility

0.0 0.0 0.0 278 KB

Sample code for creating custom relationship assistant cards

License: MIT License

C# 2.69% CSS 95.18% HTML 2.13%

dynamics-365-relationshipassistant-extensibility's Introduction

RA Card Extensibility Example

Extending Card Type

  1. Extensibility solution is placed inside ExtPkgDeployer/PkgFolder/extensibility_example_sol.zip, we will discuss about this solution later. First we will extend RA cards.

  2. Build this solution from root

      msbuild ExtPkgDeployer.sln
  3. After build is successful use PkgFolder and ExtPkgDeployer.dll from ExtPkgDeployer\bin\Debug or ExtPkgDeployer\bin\Release and follow below

    documentation for package deployment

    Deployment Preview

  4. Verify new card type is created {URL}/api/data/v9.0/cardtype(2183dfc0-3c1c-45b7-a331-1943880c25c6)

    Card Type Verification

  5. Now its time to create Action card for new card type we just created, send a POST request

    {URL}/api/data/v9.0/actioncards
    
    {
    "[email protected]": "/cardtype(2183dfc0-3c1c-45b7-a331-1943880c25c6)",
    "startdate": "2018-10-20T01:01:01Z",
    "expirydate": "2018-10-25T01:01:01Z",
    "visibility": true,
    "priority": 2000,
    "description": "This card should be visible between start and end date mentioned above",
    "title" : "Extensibility Example",
    "cardtype": 11000,
    "[email protected]" : "/systemusers({USER_ID})"
    }

    Create Request

  6. Clear session cache, open developer console and run

     sessionStorage.clear();
  7. Refresh browser and you should see Action Card

    Action Card

  8. Go to admin and you will see extended cards grouped by publishers.

    Admin Screen

Understanding Solution

  • Unzip solution placed inside ExtPkgDeployer/PkgFolder/extensibility_example_sol.zip, you will see 3 resources required for extensibility

  • new_cardtype_schemaxml9dd7e039-33a1-4778-9972-66536dc5e829

    • This contains schema definition for new cardtype
    <?xml version="1.0" encoding="utf-8" ?>
     <entity name="cardtype" displayname="Action Card Type">
       <cardname>Extensibility Example</cardname>
       <cardtypeid>2183dfc0-3c1c-45b7-a331-1943880c25c6</cardtypeid>
       <cardtype>11000</cardtype>
       <cardtypeicon>webresources/new_msicon</cardtypeicon>
       <softtitle>Extensibility Example</softtitle>
       <summarytext>RA Card Extensibility Example</summarytext> 
       <actions>{"WebClient":{"Actions":{"Open":"Mscrm.HomepageGrid.actioncard.CardCommand"},"Default":{"Open":"Mscrm.HomepageGrid.actioncard.CardCommand"}}, "Mobile":{"Actions":{"Open":"Mscrm.HomepageGrid.actioncard.CardCommand"}}}</actions>
    </entity>
  • new_commands8db43275-0291-401d-923a-90a6c373cc18

    • This contains command for Action Card
      function CardCommand() {
      window.open("https://aka.ms/salesai-raext");
      }
    • This command is invoked through RibbonDiff defined in customization.xml on Entity ActionCard
        <Entity>
        <Name LocalizedName="ActionCard" OriginalName="ActionCard">ActionCard</Name>
        <ObjectTypeCode>9962</ObjectTypeCode>
        <RibbonDiffXml>
          <CustomActions>
            <CustomAction Id="Mscrm.HomepageGrid.actioncard.CardCommand.CustomAction" Location="Mscrm.HomepageGrid.actioncard.MainTab.Actions.Controls._children" Sequence="12">
               <CommandUIDefinition>
                <Button Id="Mscrm.HomepageGrid.actioncard.CardCommand" ToolTipTitle="Open" ToolTipDescription="Open" Command="Mscrm.HomepageGrid.actioncard.CardCommand" Sequence="12" LabelText="Open" Alt="Open" Image16by16="/WebResources/new_msicon" Image32by32="/WebResources/new_msicon" TemplateAlias="o1" ModernImage="new_msicon" />
              </CommandUIDefinition>
          </CustomAction>
          <CustomAction Id="Mscrm.SubGrid.actioncard.CardCommand.CustomAction" Location="Mscrm.SubGrid.actioncard.MainTab.Actions.Controls._children" Sequence="57">
             <CommandUIDefinition>
              <Button Id="Mscrm.HomepageGrid.actioncard.CardCommand" ToolTipTitle="Open" ToolTipDescription="Open" Command="Mscrm.HomepageGrid.actioncard.CardCommand" Sequence="29" LabelText="Open" Alt="Open" Image16by16="/WebResources/new_msicon" Image32by32="/WebResources/new_msicon" TemplateAlias="o1" ModernImage="new_msicon" />
           </CommandUIDefinition>
        </CustomAction>
      </CustomActions>
      <CommandDefinitions>
        <CommandDefinition Id="Mscrm.HomepageGrid.actioncard.CardCommand">
           <EnableRules>
              <EnableRule Id="Mscrm.SelectionCountExactlyOne" />
              <EnableRule Id="Mscrm.NotOffline" />
           </EnableRules>
           <DisplayRules />
           <Actions>
              <JavaScriptFunction FunctionName="CardCommand" Library="$webresource:new_commands">
                 <CrmParameter Value="SelectedControl" />
                 <CrmParameter Value="SelectedControlSelectedItemReferences" />
              </JavaScriptFunction>
           </Actions>
        </CommandDefinition>
      </CommandDefinitions>
      <RuleDefinitions>
        <TabDisplayRules />
        <DisplayRules />
        <EnableRules />
      </RuleDefinitions>
      </RibbonDiffXml>
      </Entity>
  • new_msicon6aa7c568-4830-4da6-89f9-18a8fd9c2285

    • This is our icon displayed with Action Card

    ICON

ImportCardTypeSchema Api

  • This Api is being called by package deployer after solution install in ExtPkgDeployer\SchemaImporter.cs

       public override bool AfterPrimaryImport()
    	{
    		OrganizationRequest request = new OrganizationRequest() { RequestName = "ImportCardTypeSchema" };
    		request["SolutionUniqueName"] = "ExtensibilityExample";
    		CrmSvc.Execute(request);
    		return true;
    	}

Licensing

This feature requires the Sales Insights license.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

dynamics-365-relationshipassistant-extensibility's People

Contributors

harshvardhan3946 avatar microsoftopensource avatar allendm-msft avatar msftgits avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.