Chapter 1: Portals Overview - Adxstudio



Developer Training GuideLab WorkbookTable of Contents TOC \o "1-3" \h \z \u Chapter 1: Portals Overview PAGEREF _Toc370111917 \h 5Chapter 2: Deployment PAGEREF _Toc370111918 \h 6Exercise 1: Installing Adxstudio Portals PAGEREF _Toc370111919 \h 6Exercise 2: Practice Using the WebsiteCopy tool PAGEREF _Toc370111920 \h 8Chapter 3: CMS Components PAGEREF _Toc370111921 \h 10Exercise 1: Add new web pages PAGEREF _Toc370111922 \h 10Chapter 4: Content Publishing PAGEREF _Toc370111923 \h 13Exercise 1: Add Web Pages using Front-Side Editing PAGEREF _Toc370111924 \h 13Experiment PAGEREF _Toc370111925 \h 13Chapter 5: Security PAGEREF _Toc370111926 \h 14Exercise 1: Configure Invitation Sign Up PAGEREF _Toc370111927 \h 14Experiment PAGEREF _Toc370111928 \h 15Exercise 2: Configure Web Role and Assign Web Access Permissions PAGEREF _Toc370111929 \h 16Chapter 6: Community Features PAGEREF _Toc370111930 \h 19Exercise 1: Add a Forum PAGEREF _Toc370111931 \h 19Exercise 2: Add a Forum Thread PAGEREF _Toc370111932 \h 21Exercise 3: Add an Idea Forum PAGEREF _Toc370111933 \h 22Exercise 4: Add an Idea PAGEREF _Toc370111934 \h 23Exercise 5: Add a Blog PAGEREF _Toc370111935 \h 24Exercise 6: Add a Blog Post PAGEREF _Toc370111936 \h 25Chapter 7: Portal Theming PAGEREF _Toc370111937 \h 26Exercise 1: Edit the Copy of a Page Using Bootstrap Elements PAGEREF _Toc370111938 \h 26Exercise 2: Roll a Custom Bootstrap Theme for your Portal PAGEREF _Toc370111939 \h 28Chapter 8: Displaying Forms PAGEREF _Toc370111940 \h 29Exercise 1: Edit a CRM Form for lead PAGEREF _Toc370111941 \h 29Exercise 2: Create a Managed Form on the Portal PAGEREF _Toc370111942 \h 30Exercise 3: Create an Entity Form on the Portal PAGEREF _Toc370111943 \h 33Exercise 4: Set Up a Web Form PAGEREF _Toc370111944 \h 34Exercise 5: Set up a Survey PAGEREF _Toc370111945 \h 36Experiment PAGEREF _Toc370111946 \h 42Chapter 9: Displaying Views PAGEREF _Toc370111947 \h 43Exercise 1: Surface a CRM View as Entity List PAGEREF _Toc370111948 \h 43Exercise 2: Add an Edit Form to the Leads List PAGEREF _Toc370111949 \h 45Chapter 10: Event Management PAGEREF _Toc370111950 \h 46Exercise 1: Add Events to Basic Portal PAGEREF _Toc370111951 \h 46Chapter 11: Customer Support PAGEREF _Toc370111952 \h 47Exercise 1: Manage Cases PAGEREF _Toc370111953 \h 47Chapter 12: Service Requests PAGEREF _Toc370111954 \h 48Exercise 1: Create a new Service Request on the Portal PAGEREF _Toc370111955 \h 48Exercise 2: Create a new Service Request Entity PAGEREF _Toc370111956 \h 49Exercise 3: Create the Web Form and Service Request Type PAGEREF _Toc370111957 \h 54Chapter 14: Portal Structure PAGEREF _Toc370111958 \h 57Exercise 1: Add forums to Basic Portal PAGEREF _Toc370111959 \h 57Chapter 15: Web Controls PAGEREF _Toc370111960 \h 59Exercise 1: Add a new Page Template PAGEREF _Toc370111961 \h 59Exercise 2: Add a Property Control PAGEREF _Toc370111962 \h 61Exercise 3: Add CrmHyperLink and Snippet controls PAGEREF _Toc370111963 \h 62Experiment PAGEREF _Toc370111964 \h 63Exercise 4: Add a Weblinks Control PAGEREF _Toc370111965 \h 64Exercise 5: Add a CrmSiteMapChildView Control PAGEREF _Toc370111966 \h 65Exercise 7: Add a CrmMetadataDataSource control PAGEREF _Toc370111967 \h 66Chapter 16: Managed Forms PAGEREF _Toc370111968 \h 67Exercise 1: Edit a CRM Form for lead PAGEREF _Toc370111969 \h 67Exercise 2: Create a Managed Form on the Portal PAGEREF _Toc370111970 \h 68Chapter 17: Managed Lists PAGEREF _Toc370111971 \h 71Exercise 1: Add a CrmDataSource Control PAGEREF _Toc370111972 \h 71Exercise 2: Add a SavedQueryDataSource Control PAGEREF _Toc370111973 \h 72Exercise 3: Render a grid using the SavedQueryColumnsGenerator PAGEREF _Toc370111974 \h 73Exercise 4: Use the Portal Context to determine the current user Contact PAGEREF _Toc370111975 \h 75Exercise 5: Add Edit capability to your grid using Site Markers and an Entity Form PAGEREF _Toc370111976 \h 76Experiment PAGEREF _Toc370111977 \h 77Chapter 18: Portal Development Basics PAGEREF _Toc370111978 \h 79Exercise 1: Query CRM using early-bound classes PAGEREF _Toc370111979 \h 79Experiment PAGEREF _Toc370111980 \h 80Exercise 2: Query CRM using late-bound methods PAGEREF _Toc370111981 \h 81Experiment PAGEREF _Toc370111982 \h 81Exercise 3: Add a Comment Control PAGEREF _Toc370111983 \h 82Exercise 4: Add a Rating Control PAGEREF _Toc370111984 \h 83Chapter 19: Ads and Polls PAGEREF _Toc370111985 \h 84Exercise 1: Add an Advertisement to the Basic Portal PAGEREF _Toc370111986 \h 84Exercise 2: Add an Poll to the Basic Portal PAGEREF _Toc370111987 \h 85Chapter 20: MVC PAGEREF _Toc370111988 \h 87Exercise 1: Use the Attribute Helpers PAGEREF _Toc370111989 \h 87Experiment PAGEREF _Toc370111990 \h 88Exercise 2: Use the Site Setting Helpers PAGEREF _Toc370111991 \h 89Experiment PAGEREF _Toc370111992 \h 89Exercise 3: Use the Site Marker Helpers PAGEREF _Toc370111993 \h 90Exercise 4: Use the Snippet Helpers PAGEREF _Toc370111994 \h 91Experiment PAGEREF _Toc370111995 \h 91Exercise 5: Use the Web Link Helpers PAGEREF _Toc370111996 \h 92Experiment PAGEREF _Toc370111997 \h 93Exercise 6: Add an MVC App PAGEREF _Toc370111998 \h 94Chapter 1: Portals OverviewThere are no true exercises for this chapter, but this is a good time to check out yourself with the documentation, check out the forums, and begin planning your projects and potential projects that involve Adxstudio Portals.Chapter 2: DeploymentUse Adxstudio’s Demo builder to set up a demo portal experience. You will probably be asked to do this before the training course begins, as there is a fair amount of downtime involved.Perform the following instructions:Visit and sign up for a new CRM Online trial. Be sure to log into your new org and select the US Dollar currency before continuing. You should not continue to the next step until you have successfully logged into CRM and can see the main CRM console screen. Log into the Demo Builder website at and set up a profile for your contact information. This website shares a membership database with our community site and will give you the ability to participate in discussion forums and other features on our community site. Please use real contact information as we regularly prune contacts with false information and your demo could turned off as a result. Enter a unique domain name for your trial (domainname.demo.) Enter the CRM organization URL for your CRM Online trial Enter administrative username and password credentials. Agree to the terms of use and click the Create Demo button. Wait for an email that tells you that your environment has been configured. For the duration of the trial, you can visit your unique domain name (under demo.) to view the status of the demo and access your sample websiteExercise 1: Installing Adxstudio PortalsIn this exercise we will get Adxstudio Portals installed on your local workstation.Exercise 1a: Install Web ProjectNavigate to community.Click the download link to download the latest Portals .msi file.If you do not have an account, you will be asked to create one before you can downloadInstall the .msi file, to the default location (Program Files(x86)Open IISClick Add Website…Site Name: Basic PortalFor Physical Path, browse to C:\Program Files(x86)\ADXSTUDIO\XrmPortals\6.x.xxxx\Samples\MasterPortalSet the Port number for the website or specify a specific host name, and click OKEnsure that the app pool for the portal is set to .NET framework version 4.0.Open VS 2012Open The AdxstudioPortals solution file found under C:\Program Files (x86)\ADXSTUDIO\XrmPortals\SamplesExpand Master PortalOpen web.configModify the connection string to match your CRM online trial org’s URL, for example:<add name="Xrm" connectionString="ServiceUri=; Open IE and browse to the website Username=username@userdemo.; Password=*********;"/>Open the web.config againModify the <portals> node under <Microsoft.xrm.portal> (near the bottom of the file) so that the websiteName=“Basic Portal”Rebuild the web project.Open IE and browse to the websiteExercise 1b: Install License KeyAfter you have downloaded the Adxstudio Portals solutions from , you will receive an email with a license key for a trial version.Open the attachment (which is an XML file).Copy the contents of the file to the clipboard.Open CRM and navigate to the Settings Page.Click on Adxstudio License Keys (under the Extensions group).On the Ribbon, click the new button.In the Name field, enter: License Key.Paste the contents of the XML file that you had earlier copied to the clipboard.On the Ribbon, click the Save and Close button.Exercise 2: Practice Using the WebsiteCopy toolThis exercise is meant solely to allow you to practice using the WebsiteCopy tool. We will not be using the imported portal at any point in our future exercises. Note that we are using an XML file that contains the DATA for basic portal – so we will be creating a copy of basic portal and giving it a different name.Navigate to C:\Program Files (x86)\ADXSTUDIO\XrmPortals\6.x.xxxx\UtilitiesOpen WebsiteCopy.exeSelect “XML File” as the source of the website you will be copyingClick Next to select the name of the XML file you will be importing.Click BrowseNavigate to C:\Program Files (x86)\ADXSTUDIO\XrmPortals\6.x.xxxx\SamplesChoose Basic Portal.xmlClick NextClick NextWe now choose the destination of the websitecopy; make sure Microsoft Dynamics CRM server is selected.Click NextEnter your Discovery URL; to find this URLOpen IENavigate to the URL of the CRM trial you created in preparation for this training course and log inNavigate to Settings > Customizations > Developer resources > Service EndpointsUnder Discovery Service you will find a URL; in Websitecopy.exe choose from the dropdown the URL that matches your discovery URL. For example your credentials and click NextClick ConnectEnter Imported Portal as the website nameClick NextClick Create WebsiteIn CRMOnce the utility is finished, navigate to CRM and refreshNavigate to portals.Open Imported PortalThe content for imported Portal is IDENTICAL to basic portal, because we haven’t changed anything. So let’s change something to see a difference.Click Web PageOpen the Home pageReplace the entire Copy section with the content of your choice (type in anything you want). Be sure to replace the entire section.In VS 2012Open the web.config againModify the <portals> node under <Microsoft.xrm.portal> (near the bottom of the file) so that the websiteName=“Imported Portal”Rebuild the web project.Open IE and browse to the websiteGo Back and Modify the web.config again.Now we will switch back the portal to the standard portal for the remainder of the exercises.Modify the <portals> node under <Microsoft.xrm.portal> (near the bottom of the file) so that the websiteName=“Basic Portal”Chapter 3: CMS ComponentsExercise 1: Add new web pagesIn this exercise, we will be creating new pages within Dynamics CRM 2011 which will subsequently be displayed within the Basic Portal.Perform the following instructions:Open Internet Explorer and navigate to your CRM online trial org.Click the Portals area of the SiteMap (left-hand navigation).Click Websites.Click Basic Portal to open the Basic Portal website record.Select Web Pages.On the ribbon, click the Add New Web Page plete the following fields:Name: NewsWebsite: Basic PortalParent Page: HomePartial Url: newsDisplay Date: today’s datePage Template: PagePublishing State: PublishedCopy: This is the news page.Display Order: 9Leave the remainder of the fields on the form at their default values for now.Click the Save and New button on the ribbon to save the record and open a new one.When the new dialog is displayed, complete the following fields:Name: News Article OneWebsite: Basic PortalParent Page: NewsPartial Url: article01Copy: Lorem IpsumDisplay Order: 10Display Date: today’s datePage Template: PagePublishing State: PublishedClick the Save and New button on the ribbon to save the record and open a new one.When the new dialog is displayed, complete the following fields:Name: News Article TwoWebsite: Basic PortalParent Page: NewsPartial Url: article02Copy: DolorDisplay Order: 11Display Date: today’s datePage Template: PagePublishing State: PublishedClick the Save and Close button on the ribbon to save the record and close the page.Select Web Link Sets.Open Primary Navigation.Click once on the Links grid on the form.Click the Add New Web Link button on the ribbon.Name: NewsPage: NewsPublishing State: PublishedClick Save & CloseIn VS 2012:Refresh the Adxstudio cache by resetting the Basic Portal in IIS or Rebuilding the Basic Portal Project in VS 2012Navigate to the Basic Portal website in IEYou will notice that News now appears on the primary navigation bar at the top of the page.Click on NewsNotice the Child links that appear. These are being generated by the “Page” Page Template.Chapter 4: Content PublishingExercise 1: Add Web Pages using Front-Side EditingIn this exercise we will add new pages using the Front-Side editing feature.Perform the following steps:Navigate to Basic PortalClick Sign In in the upper right-hand corner.Sign in as administrator:Username: administratorPassword: pass@word1Navigate to the Content page by clicking the link on the primary navigation.From the floating-menu, click the New button then select Child plete the following properties:Name:Example ContentCopy: This is the Example Content pageLeave the remainder of the properties at their default values.Click the Save button to save your changes.Move your mouse over the Primary Navigation and click the Edit button.Click the Add button (green plus).Complete the following properties:Name: Example ContentPage: Example ContentClick the Save button to save the new navigation link.Click the Save button to save your changes to the Primary Navigation.After the page reloads, you should see your new pages on the Primary Navigation bar.Navigate to Example Content pageClick to create a child file. Upload a sample picture from your documents folder (or download a free image from Bing images and upload that)After creating the child file, try editing the “copy” attribute of the page and adding the child file, using the file picker. ExperimentTry Utilizing different page templates - take note of how different page templates render content, shortcuts and links in different ways. Try adding Shortcuts, Links, Files in different ways. Try experimenting with the tinyMCE editor to add rich content to the copy of your web pages: Tables, lists, etc. Chapter 5: SecurityExercise 1: Configure Invitation Sign UpIn this exercise we will configure sign-up for new users to the portal. Note that by default new CRM online orgs are not configured for email routing, so we won’t make use of any of our email workflows. However, your instructorPortalNavigate to your Basic Portal websiteIf you are signed in, sign outClick to Sign InOn the Sign In page, instead of signing in, attempt to ‘sign up’. The link to sign up is located in the grey panel above the sign in form.Create an account:Username: jdoePassword: pass@word1Question: Yes or No?Answer: YesYou must now fill out your profile info. Note that you are already a portal user at this point, but before you can use the site’s features you must fill out basic contact info:First Name: JonLast Name: DoeEmail: [your email]CRM:Navigate to Contacts via WorkplaceNote the contact that was created. Open up the contact You may be in the new “metro-style” touch interface for CRM 2011. This view is currently incompatible with multiple forms, so we will turn it off for now. If you are already in classic view, ignore this step.Locate three small dots at the top left-hand side of the screenClick on themChoose Switch to classic viewNavigate to the Portal Contact form and view the Web Authentication tab to view the fields created that associate this contact to the new portal user.Navigate to PortalsOpen Basic PortalNavigate to Site Settings on the left-hand navigation paneOpen the Authentication/Registration/Enabled Site SettingSet its value to “false”PortalRebuild your project in VS 2012Navigate to the Portal and go to the Sign In pageNote that now you cannot Sign up; the website is invitation-onlyExperiment Attempt to set the authentication mode so that you can freely sign up, but portal access is not granted until a confirmation email is responded to. Use the Authentication/Registration/RequiresConfirmation Site Setting (set the ../../RequiresInvitation Site Setting back to “false”). Note that unless you install Microsoft CRM for outlook emails won’t work.Exercise 2: Configure Web Role and Assign Web Access PermissionsIn this exercises we will be creating two web roles and experimenting with how different permissions restrict what these roles can and cannot do in terms of the portal. To this end we will be adding nodes to the site map and then granting our user read/change to these nodes.In CRM:Navigate to Portals, Web Sites.Open Basic Portal.Click on the Web Pages navigation link on the left-hand sideOn the Ribbon, click on the Add New Web Page plete the following fields:Name: StatisticsWebsite: Basic PortalParent Page: HomePartial Url: statsDisplay Date: today’s datePage Template: PagePublishing State: PublishedCopy: This is the statistics page.Display Order: 9On the Ribbon, Click the Save and Close button.In this step we will add the new page and two child pages under news. If you already have created these pages from a previous exercise, don’t bother creating them again. Just skip to step 8 On the ribbon, click the Add New Web Page button. Complete the following fields:Name: NewsWebsite: Basic PortalParent Page: HomePartial Url: newsDisplay Date: today’s datePage Template: PagePublishing State: PublishedCopy: This is the news page.Display Order: 10Click the Save and New button on the ribbon to save the record and open a new one.When the new dialog is displayed, complete the following fields:Name: News Article OneWebsite: Basic PortalParent Page: NewsPartial Url: article01Page Template: PagePublishing State: PublishedCopy: Lorem IpsumDisplay Order: 1Click the Save and New button on the ribbon to save the record and open a new one.When the new dialog is displayed, complete the following fields:Name: News Article TwoWebsite: Basic PortalParent Page: NewsPartial Url: article02Page Template: PagePublishing State: PublishedCopy: DolorDisplay Order: 2Click the Save and Close button on the ribbon to save the record and close the page.Click the Web Roles navigation link.On the Ribbon, click the Add New Web Role plete the following fields:Name: News EditorWebsite: Basic PortalAuthenticated Users Role: NoOn the Ribbon, click the Save button.Click on the Web Page Access Control navigation link.On the Ribbon, click the Add Existing Web Page Access Control button.When the “Look Up Records” dialog appears, click the New plete the following fields:Name: View StatisticsWebsite: Basic PortalWeb Page: StatisticsRight: Restrict ReadLeave the remainder of the fields on the form at their default values for nowOn the Ribbon, Click the Save and Close button.Click OK on the Look up Records dialogOn the Ribbon, click the Add Existing Web Page Access Control button.When the “Look Up Records” dialog appears, click the New plete the following fields:Name: Grant News Change to News EditorsWebsite: Basic PortalWeb Page: NewsRight: Grant ChangeLeave the remainder of the fields on the form at their default values for nowOn the Ribbon, Click the Save and Close buttonClick OKNavigate to ContactsClick to Add an existing contact to this web roleIn the lookup Dialog, click NewYou may be in the new “metro-style” touch interface for CRM 2011. This view is currently incompatible with multiple forms, so we will turn it off for now. If you are already in classic view, ignore this step.Locate three small dots at the top left-hand side of the screenClick on themChoose Switch to classic viewNavigate to the Portal Contact form and view the Web Authentication tab to view the fields created that associate this contact to the new portal user.Give the Contact the following fields:First name: JonLast Name: doeUsername: jdoeReset Password To: pass@word1Logon Enabled: trueClick Save & CloseVS 2012:Rebuild the MasterPortal projectNavigate to the Basic Portal in IENavigate to the URL for the statistics page: you do not have read access to the pageLogin as Jon Doe: jdoe; pass@word1Navigate again to the statistics pageNotice you have accessNavigate to the News pageNotice you may edit the content on this pageNavigate to News Article 1Notice you also have access to this pageChapter 6: Community FeaturesExercise 1: Add a ForumConfigure the Community PortalOpen VS 2012Open The AdxstudioPortals solution file found under C:\Program Files (x86)\ADXSTUDIO\XrmPortals\6.x.xxxx\SamplesExpand Master PortalOpen web.configModify the connection string to match your CRM online trial org’s URL, for example:<add name="Xrm" connectionString="ServiceUri=; Username=username@userdemo.; Password=*********;"/>Open IE and browse to the websiteOpen the web.config againModify the <portals> node under <Microsoft.xrm.portal> (near the bottom of the file) so that the websiteName=“Community Portal”Rebuild the web project.Open IE and browse to the websiteAdd a ForumNavigate to the CRMClick the Portals area of the SiteMap (left-hand navigation).Click Websites.Click Community Portal to open the Community Portal website record.Click Forums on the left-hand nav barClick to Add a New ForumGive it the following attributes:Name: Example ForumWebsite: Community PortalParent Page: ForumsPartial URL: example-forumPublishing State: PublishedForum Page Template: ForumThread Page Template: Forum ThreadSave & CloseIn VS 2012Rebuild the ProjectNavigate to the Community PortalNavigate to ForumsNotice that the new example forum you have created is visibleClick to view the forum. Note that because there are no forum threads, the only option at this point is to create a new thread.Exercise 2: Add a Forum ThreadNavigate to the Community PortalLog in as administratorUsername: administratorPassword: pass@word1Navigate to a Forum (For example, the Example Forum you created in the last exercise)Navigate to the “Create a New Thread” section of the pageFill in the required fields to add a new forum threadThread Title: Question about ForumsType: QuestionContent: “I have a question about forums, can someone help me?”Click the Create this Thread buttonYou will be taken to the new thread you have createdPost a reply: Type “Yes” in the Content box and click Post this ReplyNavigate to the Support Forum page by clicking the link in the breadcrumbsNotice the thread you created: Notice it is a question (indicated by the question mark icon) and that it has one replyNavigate back into the threadClick the Mark as answer button next to the response you just postedIf you navigate back to the Support Forum page, you will notice the thread is now marked as answeredNavigate back into the thread.Click Edit on the toolbar at the upper right-hand corner of your browserCheck “Sticky?”Click SaveNavigate to the Support Forum page by clicking the link in the breadcrumbsNotice the thread is Sticky now.Exercise 3: Add an Idea ForumCRMNavigate to the CRMClick the Portals area of the SiteMap (left-hand navigation).Click Websites.Click Community Portal to open the Community Portal website record.Click Idea Forums on the left-hand navigation areaClick to Add a New Idea ForumGive the Idea Forum the Following values:Title: Example Idea ForumWebsite: Community PortalPartial URL: example-idea-forumType of Voting: RatingMaximum Rating: 5Click Save & CloseIn VS 2012Rebuild the ProjectNavigate to the Community PortalClick on Ideas on the primary navigation barNotice that the new Example Idea Forum you have created is visibleExercise 4: Add an IdeaNavigate to the Community Portal websiteSign in as Administrator if you are not already signed in.Click on Ideas on the primary navigation barOpen the Example Idea Forum we create in the previous exerciseNavigate to the Suggest a New Idea part of the pageIn the Idea textbox, type “Example Idea”For the Description, type “Lorem Ipsum”Click Submit IdeaNote that your Idea appearsYou may up-vote your Idea by clicking on the Up-pointing arrow button to the left of the idea.You may assign a score to the idea. Try clicking +3The Idea will now have a rating of 4.Experiment: Sign out of the portal. You are now anonymous. Navigate back to that same idea as before? Can you vote on it? Comment on it? Why? Try playing around with different Idea settings to get different effects in terms for how Ideas can be voted on.Exercise 5: Add a BlogNavigate to the CRMClick the Portals area of the SiteMap (left-hand navigation).Click Websites.Click Community Portal to open the Community Portal website record.Click Blogs on the left-hand navigation areaClick to Add a New BlogGive the Blog the Following values:Name: My Own Little BlogWebsite: Community PortalParent Page: BlogsPartial Url: little-blogHome Template: BlogPost Template: Blog PostArchive Template: Blog SearchSummary: “This is my Own Little Blog”Comment Policy: OpenClick SaveClick on Author Roles on the left-hand side of the Blog form windowClick to Add Existing RoleAdd the Administrators role related to the Community Portal Website.Click OKSave & Close the BlogIn VS 2012Rebuild the ProjectNavigate to the Community PortalClick on Blogs on the primary navigation barNotice that the new Blog you have created is visible – a Link to it shows up on the right-hand sidebar.Exercise 6: Add a Blog PostNavigate to the Community Portal websiteSign in as Administrator if you are not already signed in.Click on Blogs on the primary navigation barOpen the Blog we create in the previous exercise (My Own Little Blog) by clicking on the link on the right-hand sidebarClick New > Blog Post on the toolbox in the upper-right hand corner of the browserName the Blog Post “This is my First Post” and enter in something funny or interesting in the Copy section.Give the Blog Post a partial URL of first-post and Click SaveYou Blog Post is now up on the portal. Experiment: Try commenting on the Blog post both as yourself and as anonymous users. How do you enable Ratings for the Blog post? How to blog posts get aggregated? Play with the options and let the instructor know if you have any questions.Chapter 7: Portal ThemingExercise 1: Edit the Copy of a Page Using Bootstrap ElementsNavigate to the Basic Portal WebsiteLogin as Administrator if you are not already logged in.Navigate to Content > Content PageEdit the Copy using front-side editingThe tinyMCE editor will appearLet’s play with a new simple styles that we can attach to elements:Beneath the current content block, type a sentence “This is a sentence”Follow this with a few paragraph breaks by hitting enter on your keyboard several timesHighlight the sentence and from the Styles dropdown select “Alert Info”SaveNotice that the sentence you added is surrounded by an alert boxClick to edit the content block again.Place your text cursor beneath the alert block you added Insert a table by clicking the insert table button, which is on the bottom row of buttons, all the way to the left-hand side (two down from the save button)Choose 3 rows and 3 columnsPlace some dummy content spread throughout the tableSaveNotice how the table looksClick to edit the content block again.Select the tableClick to Insert and Attribute by clicking the button just left of the Format DropdownClick the Class dropdown and select table (begin typing the word to have the dropdown find it for you)SaveNotice how the table looksClick to edit the content block again.Now Edit the Markup by clicking the html buttonFind the <table> node. It should have an attribute class=“table”. Change this to class=“table table-striped”SaveNotice how the table looksNow let’s do some very basic scaffolding. If you are not comfortable with HTML, you can choose to skip this exercise. Alternatively, you can take a stab at it and ask the instructor for help.Click to edit the content block again.Split the original Lorem Ipsum content block into two paragraphsNow Edit the Markup by clicking the html buttonNotice the original main content block is split into two <p> tags: one for each of the two paragraphs you just split it into.Wrap both of these <p> tags within a <div> tag that has class=“row”Now wrap the first <p> tag within a <div> tag that has class=“span3”Now wrap the second <p> tag within a <div> tag that has class=“span5”Notice you have two paragraphs present in a side-by-side paragraph format.Experiment: Choose several components from the Bootstrap website under the “components” or “Javascript” tab. Try to do as much as you can with the content editor, but feel free to crack open VS 2012 and edit the page templates if you wish to do. Try to do something really cool.Exercise 2: Roll a Custom Bootstrap Theme for your PortalNavigate to OR to start Creating/ Rolling your themeBE CREATIVEOnce you are finished creating your theme, Download the CSS file the matches your theme. If using themeroller, just click the download link to grab a zip file which contains your bootstrap.min.css file. If using bootswatchr, you’ll need to click the CSS dropdown near the top of the page and choose minified and then copy and paste everything into a file called bootstrap.min.cssNavigate to the Basic Portal WebsiteSign in as administratorOn the home page, click to create a New child file by clicking New > child file on the front-side editing toolbar.Choose the bootstrap.min.css file you create by rolling your theme as the file upload.For the name and partial URL both, enter bootstrap.min.cssClick SaveRefresh your cache by resetting the site in IIS, or rebuilding the project in VS 2012.Your theme should be applied to the portal!Chapter 8: Displaying FormsExercise 1: Edit a CRM Form for leadIn this exercise, we will set up a CRM form which we will later use to demonstrate the functionality for the CrmEntityFormView control, the Entity Form feature, and the Web Form feature.Please perform the following:In CRM, first we will create the CRM form itself:Open Internet Explorer and navigate to your CRM online trial orgNavigate to the Settings Area of the Site MapClick CustomizationsClick Customize the SystemSelect Lead from the list of entities on the left navigation of the solution editor window.Click FormsOpen the form titled Web FormClick to Save As…Name the form New Contact Us FormRemove the following fields from the form: Street 1, City, State/Province, ZIP/Postal Code, Country/Region, DescriptionSave and Close the form again.Reorder the forms so that the new form you create is not the default form:Click Form OrderClick Main Form SetMove the newly created form to the bottom of the listClick OKClick Publish All Customizations – if this option isn’t shown, click to “information on the left-hand side of the main solution windowExercise 2: Create a Managed Form on the PortalIn this exercise, we will utilize the CrmEntityFormView control to render our Contact Us form on the portal.Navigate to Portals – we will now add the page to the website that will render this formOpen the Basic Portal website.Create a new Page Template for your form:Click Page TemplatesClick NewSpecify the Name as Managed Forms Contact UsWebsite: Basic PortalSpecify the Rewrite URL as ~/Pages/CrmEntityFormViewContactUs.aspx (we will create this in the web project later)Click Save & CloseCreate a new Web Page using this template:Click Web PagesClick NewSpecify the Name as Managed Forms Contact UsSelect the appropriate WebsiteSelect the Home page as the Parent PageSpecify managed-forms-contact-us as the partial URLSelect the Managed Forms Contact Us Page Template created earlierSelect Published as the publishing stateClick Save & CloseNavigate to Web Link SetsClick Primary NavigationClick Web LinksClick NewGive the web link the follow values:Name: Managed Contact UsPage: Managed Forms Contact UsPublishing State: PublishedSave & CloseIn Visual StudioOpen Visual Studio 2012.Select File, Open Project.Navigate to: C:\Program Files\ADXSTUDIO\XrmPortals\6.X.XXXX\Samples.Select AdxstudioPortals.sln then click the Open button.In the Solution Explorer, expand the project: MasterPortal.Create a new Web Form using Master Page in the ~/pages folderUse the WebForms.master pageSave the file as “CrmEntityFormViewContactUs.aspx” in Pages folder contained in the root of the project.Replace the markup of the page with the following:<asp:Content ContentPlaceHolderID="Head" runat="server"><link rel="stylesheet" href="~/css/webforms.css" /></asp:Content><asp:Content ContentPlaceHolderID="MainContent" ViewStateMode="Enabled" runat="server"><asp:Panel ID="ContactForm" CssClass="crmEntityFormView frame" runat="server" Visible="true"><adx:CrmEntityDataSource ID="WebFormDataSource" runat="server" /><adx:CrmEntityFormView runat="server" ID="FormView" EntityName="lead" FormName="New Contact Us Form" DataSourceID="WebFormDataSource" OnItemInserted="OnItemInserted"></adx:CrmEntityFormView></asp:Panel><asp:Panel ID="ConfirmationMessage" runat="server" Visible="false"><crm:Snippet runat="server" SnippetName="ContactUs/ConfirmationMsg" DefaultText="Thank you. Your message has been successfully submitted." EditType="html" /></asp:Panel></asp:Content>Also add the following using Statements, to the using declarations at the top of the code-behind:using Adxstudio.Xrm.Web.UI.WebControls; using Microsoft.Xrm.Portal.Web.UI.WebControls;Now add the following method to the code behind. This event handler is triggered when the form has successfully inserted the new record upon form submission:protected void OnItemInserted(object sender, CrmEntityFormViewInsertedEventArgs e){ContactForm.Visible = false;ConfirmationMessage.Visible = true;}Build the project.Let’s try out the form in the portal:Navigate to the Basic Portal. Navigate to the Managed Form Contact Us page on the portal. You should now see a form resembling the one you created in CRM.Fill in the formFirst name: JohnLast Name: DoeRemaining values can be whatever you wishCRM:View the Submitted Leads in the CRM Navigate to SalesClick LeadsFind the John Doe record and open itNote the lead created matches the data previously entered though the portal.Exercise 3: Create an Entity Form on the PortalNavigate to Portals – we will now add the page to the website that will render this formNavigate to Entity FormsCreate a new Entity FormName:Entity Form Contact UsEntity Name: LeadForm Name: New Contact Us FormMode: InsertClick Save & CloseOpen the Basic Portal website.Create a new Web Page:Click Web PagesClick NewSpecify the Name as Entity Form Contact UsSelect the appropriate WebsiteSelect the Home page as the Parent PageSpecify entity-form-contact-us as the partial URLSelect the Full Page Page TemplateSelect Published as the publishing stateSelect Entity Form Contact Us as the Entity Form Click Save & CloseNavigate to Web Link SetsClick Primary NavigationClick Web LinksClick NewGive the web link the follow values:Name: Entity Form Contact UsPage: Entity Form Contact UsPublishing State: PublishedSave & CloseLet’s try out the form in the portal:Rebuild your VS 2012 projectNavigate to the Basic Portal. Navigate to the Entity Form Contact Us page on the portal. You should now see a form resembling the one you created in CRM.Exercise 4: Set Up a Web FormHere we will be creating essentially the same result as in the previous exercises, but using web forms. We will be using the same New Contact Us Web Form we created earlier.In CRM:Create a New Web Page, Web Form, and Web Form Step for your lead (Contact Us) Form:Navigate to Portals > Basic Portal > Web PagesClick NewGive the web page the following values:Name: Contact Us Web FormPartial Url : contact-us-web-formPublishing State: publishedPage Template: Full PageWebsite: Basic PortalParent Page: HomeClick SaveClick to Open the Web Form lookup window; so that you can associate the Contact us form to the pageClick NewSpecify a Name for the Web Form: “Contact Us”Click SaveClick Start Step lookup buttonClick New, and give the step the follow values:Name: Load Contact Us FormWeb Form: Contact UsType: Load FormEntity Logical Name: leadMode: InsertForm Name: New Contact Us FormSuccess Message: Thank you for contacting us.Click Save & Close or click OK on all open windowsNavigate to Web Link SetsClick Primary NavigationClick Web LinksClick NewGive the web link the follow values:Name: Contact Us Web Form Page: Contact Us Web FormPublishing State: PublishedSave & CloseLet’s try out the form in the portal:Rebuild your VS 2012 projectNavigate to the Basic Portal. Navigate to the Web Form Contact Us page on the portal. You should now see a form resembling the one you created in CRM.Exercise 5: Set up a SurveyIn CRM, We will be creating a new entity that represents a survey we will be presenting to users via the portal. This is represented by an entity in the CRM containing the questions for the survey. This means that the entity itself represents the specific survey, while the records created by the web form submission represent survey submissions.Exercise 5a: Create the Survey Entity in CRMLogin to CRMNavigate to SettingsClick CustomizationsClick Customize the SystemClick New > EntityFill in the required fields: Choose a name the reflects this is a survey: Customer Support Survey Plural Name: Customer Support SurveyLogical Name: new_customersupportsurveySet the entity to display in the Workplace area of the site mapClick SaveNow we add our questions to the surveyClick FieldsAdd Fields representing questions:Add a Text Area QuestionClick NewSet the Name to “Description”Logical name: new_descriptionRequirement Level: RequiredChoose Multiple Lines of Text for the TypeSave & CloseAdd a Text Area QuestionClick NewThe Name for the question: “How Heard”Logical name: new_howheardChoose Single Line of Text for the TypeSave & CloseAdd a True/False QuestionClick NewThe Name for the question: “Gold Star”Logical name: new_goldstarChoose Two Options as the TypeSave & CloseAdd a Multiple Choice QuestionAdd a series of fields, each one representing an answer to the question you have planned (“How may we contact you?”)Click NewName: “Email”Logical name: new_mc1_emailChoose Two Options as the TypeSave & CloseClick NewName: “Phone”Logical name: new_mc1_phoneChoose Two Options as the TypeSave & CloseClick NewName: “Fax”Logical name: new_mc1_faxChoose Two Options as the TypeSave & CloseAdd a Likert Scale QuestionClick NewThe Name for the question: “Quality Rating”Logical Name: new_qualityratingSelect the Option Set TypeChoose Use an Existing Option SetChoose Likert Scale QualitySave & CloseWe will also add a field that will record the current portal user.Click NewDisplay Name: Contact(Logical) Name: new_contactidType: LookupTarget Record Type: ContactRelationship Name: new_contact_customersupportsurveySave & CloseFrom the Customer Support entity you have just created (either the window that is still open or, if you closed it – by navigating to the entity in the solution window) Click Forms; it is now time to create the CRM forms that will be rendered to display the surveyClick to create a new “main form”.Click Save As and save it as Survey Step 2Click Save As and save it as Survey Step 1First we will edit the form for step 1 of the surveyClick on the Name field on the form, and then click PropertiesUncheck “Visible by default”Check “Field is Read-only”Close Properties windowClick on the Owner field on the form, then click PropertiesUncheck “Visible by default”Check “Field is Read-only”Close properties windowClick on the Notes tab on the formClick RemoveAdd the text area and true/false question to the form, in a layout that you desire:Drag and Drop the Description field onto the formClick on it and click PropertiesSet the label to “Please give a description of the problem you contacted us for”Click OKDrag and Drop the How Heard field onto the formClick on it and click PropertiesSet the label to “How did you first hear about us?”Drag and drop the Gold Star field onto the formClick on it and click PropertiesSet the label to “Are you a gold star member?”Save & Close the formNow we will edit the form for Step 2Click to open the Survey Step 2 formClick on the Name field on the form and click PropertiesUncheck “Visible by default”Check “Field is Read-only”Click on the Owner field on the form, the click PropertiesUncheck “Visible by default”Check “Field is Read-only”Click on the Notes tab on the formClick RemoveDrag and drop the Quality Rating field onto the formClick on it and click propertiesSet the label to “Please Rate the quality of service you received from us”Add the multiple choice question:Click the Insert tab above the ribbonClick for a Two-Column sectionDouble-click on the newly created sectionSet the Label of this section to be: “How may we contact you?”Click Show the label of this section on the FormClick OKAdd each response to this question you created earlier to this section:Drag and drop the ‘Email’ field onto the formDouble-click on it or select it and click propertiesClick FormattingSelect Check Box as the Control FormattingClick OKDrag and drop the ‘Fax’ field onto the formDouble-click on it or select it and click propertiesClick FormattingSelect Check Box as the Control FormattingClick OKDrag and drop the Phone field onto the formDouble-click on it or select it and click propertiesClick FormattingSelect Check Box as the Control FormattingClick OKSave & CloseClick on the Form Order and choose Main Form SetMove the Information form to the topClick OKNow we edit the main information form so we can view the results later.Open the Information FormAdd the text area and true/false question to the form, in a layout that you desire:Drag and Drop the Description field onto the formClick on it and click PropertiesSet the label to “Please give a description of the problem you contacted us for”Click OKDrag and Drop the How Heard field onto the formClick on it and click PropertiesSet the label to “How did you first hear about us?”Drag and drop the Gold Star field onto the formClick on it and click PropertiesSet the label to “Are you a gold star member?”Drag and drop the Quality Rating field onto the formClick on it and click propertiesSet the label to “Please Rate the quality of service you received from us”Add the multiple choice question:Click the Insert tab above the ribbonClick for a Two-Column sectionDouble-click on the newly created sectionSet the Label of this section to be: “How may we contact you?”Click Show the label of this section on the FormClick OKAdd each response to this question you created earlier to this section:Drag and drop the ‘Email’ field onto the formDouble-click on it or select it and click propertiesClick FormattingSelect Check Box as the Control FormattingClick OKDrag and drop the ‘Fax’ field onto the formDouble-click on it or select it and click propertiesClick FormattingSelect Check Box as the Control FormattingClick OKDrag and drop the Phone field onto the formDouble-click on it or select it and click propertiesClick FormattingSelect Check Box as the Control FormattingClick OKFinally, add the Contact Lookup field to the form, so we know who wrote the surveySave & CloseClick Publish All CustomizationsExercise 5b: Create the Web Form DataNow that the Entity and the CRM forms have been created, we can create the web form data for our survey and associate the survey with a web page so that it shows up on our portal. Let the instructor know if at any point you get lost during this process.Navigate to Portals -> Web PagesClick NewGive the web page the following values:Name: Customer Support SurveyPartial Url : customer-survey Publishing State: PublishedWebsite: Basic PortalParent Page: HomePage Template: Full PageClick SaveClick to Open the Web Form lookup window – we will add the web form to the page (if you closed the web page form, you can create the web form first then later add it to this web page by re-opening it)Click New to create a new web form.Specify a Name for the Web Form: “Customer Support Survey”Set Multiple Records Per User Permitted to “false”Set Authentication Required to “true”Click Save (but do not close the form – we aren’t done yet!)Click Start Step lookup buttonClick New, and give the step the follow values:Name: Survey Step 1Type: Load FormEntity Logical Name: new_customersupportsurveyMode: InsertForm Name: Survey Step 1Associate Current Portal User: True (check it)Target Entity Portal User Lookup Attribute: Contact (new_contactid)Click SaveClick Next Step lookup buttonClick New, and give the step the follow values:Name: Survey Step 2Type: Load FormWeb Form: Customer Support SurveyEntity Logical Name: new_customersupportsurveyMode: EditSource Type: Result From Previous StepForm Name: Survey Step 2Success Message: “Thank you for your submission”Save (don’t close it – we are going to add a related entity)Click Metadata from the Survey Step 2 left navigationClick Add New Web Form MetadataSpecify the Attribute Logical Name to be the logical name of the Likert scale question you created: new_qualityratingSelect Option Set as Horizontal Radio Button List from the style dropdown, Control Style sectionClick Save & Close or OK all windows that remain openPortalRebuild your web project or reset the website in IIS to reset the cacheNavigate to the portalSign in as administratorEdit the primary navigation Web Link Set by clicking the Edit button that appears when you mouse of the primary navigation.Add a new web link by clicking the “+” iconFill in the following fields:Name: SurveyPage: Customer Support SurveySaveYou may now take the survey, navigate to the URL you specified for your survey and take the survey.Exercise 5c: View Survey ResultsIn CRMNavigate to WorkplaceNavigate to Customer Support SurveysLocate the survey submission you just created and open itFrom here you can view the results of the survey by reading the form.Experiment1) Attempt adding more and different question types, Web Forms Steps, and metadata to your survey.2) What sorts of processes would you build to surround this survey? What sorts of workflows would be appropriate? How would the survey be distributed? How would the data be used? Jot down some ideas.3) Try Creating a Report in CRM to view the results of the survey. What’s the best way to create a meaningful report? Any limitations?Chapter 9: Displaying ViewsExercise 1: Surface a CRM View as Entity ListIn this exercise, we will set up a CRM view which we will then surface on the portalPlease perform the following:In CRM, first we will create the CRM form itself:Open Internet Explorer and navigate to your CRM online trial orgNavigate to the Settings Area of the Site MapClick CustomizationsClick Customize the SystemSelect Lead from the list of entities on the left navigation of the solution editor window.Click ViewsOpen the view titled Open LeadsClick to Save As…Name the form New Open Leads ViewClick the Name Column and click Change PropertiesChange the width to 200px and click saveRemove the Created On column from the formClick Add ColumnsCheck Email and click OKSet the width of the Email Column to 200pxSave and Close the view again.Click Publish All Customizations – if this option isn’t shown, click to “information on the left-hand side of the main solution windowNavigate to PortalsOpen up the Basic Portal Website recordCreate a new Web Page:Click Web PagesClick NewSpecify the Name as Open Leads ListSelect the appropriate WebsiteSelect the Home page as the Parent PageSpecify open-leads-list as the partial URLSelect the Full Page Page TemplateSelect Published as the publishing stateClick Save Open the Entity List lookup windowClick NewNow we are creating a new Entity View record to surface on the pageFill in the following attributes:Name: Open Leads ListEntity Name: Lead (lead)View: New Open Leads ViewPage Size: 10Click Save & CloseClick OKClick Save & CloseNavigate to Web Link SetsClick Primary NavigationClick Web LinksClick NewGive the web link the follow values:Name: Open Leads ListPage: Open Leads ListPublishing State: PublishedSave & CloseLet’s try out the form in the portal:Rebuild your VS 2012 projectNavigate to the Basic Portal. Navigate to the Open Leads List page on the portal and view the list you created.Exercise 2: Add an Edit Form to the Leads ListWe will now make Records displayed on our Leads list editable by adding an edit page to our Entity List. To do this, we will create a Page that has an entity form associated with it and assign this as the details page for the Entity List. We will re-use our contact us form we created earlier.In the CRM, navigate to Portals Click Entity ListsOpen up the Open Leads List Entity List you created in the previous exerciseClick the Web Page for Details View lookup Window Click NewCreate the Web Page that will be used for the details page. Give it the following attributes:Name: Lead Edit FormWebsite: Basic PortalParent Page: Open Leads ListPartial Url: editPage Template: Full PagePublishing State: PublishedClick SaveNow Open the Entity Form Lookup Window.Click NewWe will now create a new Entity Form to use in edit mode. We will reuse the Contact Us form we created in the previous chapter. Name:Edit Lead FormEntity Name: LeadForm Name: New Contact Us FormMode: Edit Record Source Type: Query StringRecord ID Query String Parameter Name: id Save & Close or click OK on all open windowsLet’s try out the form in the portal:Rebuild your VS 2012 projectNavigate to the Basic Portal. Navigate to the Open Leads List page on the portal and view the list you created. Note you have now an edit form. Experiment: Try adding a redirect to your edit form so after completing the form you will be taken back to the Entity List page. Once you have done this, try replacing your edit form with a web form instead that does the same thing. Split the web form into multiple steps afterwards. Play around with the options.Chapter 10: Event ManagementExercise 1: Add Events to Basic PortalFirst, we will enable Events for Basic Portal by added the Page Template to render out Event Schedules from the Events Area in Master PortalIn CRM, Navigate to Portals > Basic PortalNavigate to Page TemplatesClick Add New Page TemplateEnter Events as the nameAdd “~/Areas/Events/Pages/Events.aspx” as the Rewrite URLClick Save & CloseNavigate to Web PagesClick Add New Web PageFill out the following fields:Name: EventsWebsite: Basic PortalParent Page: HomePartial URL: eventsPage Template: EventsPublishing State: PublishingSave & CloseSecond, we will be creating a new event and event schedule that will be added to the portalNavigate to EventsClick Add New EventAdxstudio PortalsFill in the required fieldsName: Adxstudio Portals TrainingWebsite: Basic PortalParent Page: EventsPartial Url: adxstudio-portals-trainingPublishing State: PublishedClick Event Schedules on the Left-hand side NavigationChapter 11: Customer SupportExercise 1: Manage CasesNavigate to the Community Portal through Demo Builder. If you forget the URL for community Portal, you will be able to find t by navigating into the CRM and going to your website bindings.Click Sign In in the upper right hand cornerUsername: administratorPassword: pass@word1Navigate to Help DeskClick on the search bar and type in “Lorem Ipsum”.Notice the result links that come up: You can’t create a case until you have at least searched for existing results first. Click on one of them and inspect.Click the Back button in your browserClick the Open a New Support Request button at the bottom of the search resultsWhen it asks you to choose a customer to assign the Support Request to, choose Adxstudio Inc.Click NextIn the “Details of the Problem” field, enter “Lorem Ipsum Dolor”Enter in the case information:Title: “Lorem Ipsum”Case Type: ProblemCustomer: Assigned to MeAdditional Notes: “Dolor Pellentesque nunc sapien.”Click Create CaseClick Add Note in the upper right hand cornerFill in the note details: This is an example noteUpload an attachment by click on the “choose file” button. Choose an image from the sample images folder in windows.Notice that the note is added at the button the case screen.Click Resolve Case in the upper right corner.Specify a resolution of “Lorem Ipsum”Specify a description of “Case was resolved via Lorem Ipsum”Click Resolve CaseThe case is now resolved. Click Reopen Case and confirm.Click Cancel Case and confirm. The case is now cancelled.Click Reopen Case.In the breadcrumbs at the top of the page, click Support.Note that the case you created is in the list of cases under the search bar.Try creating another case, except this time for the customer, try assigning the case to your parent customer account.Go back to the support page, and click the view dropdown to adjust viewing your cases vs. your parent company cases.Chapter 12: Service RequestsExercise 1: Create a new Service Request on the PortalNavigate to the Government Portal through the demo builderLog in as administrator if you are not already logged inNavigate to 311Click to open a Pothole service requestFill in the form – if possible, try using a real address for the “Location” field that will appear on a map (like your house or place of work, or a famous landmark in your home city) Click submit. Take Note of the Service Request NumberNavigate again to 311Click View MapNotice that your service request is located on the mapIn the upper right hand corner, you will see your logged-in username (System Administrator)Click on the down-pointing arrow next to your logged-in username to view the profile navigation web link setClick My Service RequestsYou will see your service request that you created earlierExercise 2: Create a new Service Request EntityIn this exercise we will add a new service request type. This can be done without needing to make any code changes to the web project.First we will be creating a new custom service request entity, to store the data for our custom service request typeIn CRM, navigate to SettingsNavigate to Customize the SystemClick EntitiesClick New to create a new entitySet the required fields:Display Name: Special RequestPlural Name: Special RequestsName: new_specialrequestOwnership: User or TeamCheck “Service” in sitemap areas sectionEnsure Notes is checkedEnsure Activities are checkedCheck QueuesClick SaveClick FieldsAdd Fields for all the mandatory Fields that need to be mapped to the generic service request entity.Add the “Closed Date” fieldClick NewSet the Display Name to “Closed Date”Logical name: new_closeddateType: Date and TimeFormat: Date and TimeSave & CloseAdd the “Email Address” fieldClick NewSet the Display Name to “Email Address”Logical name: new_emailaddressType: Single Line of TextFormat: EmailSave & CloseAdd the “First Name” fieldClick NewSet the Display Name to “First Name”Logical name: new_firstnameType: Single Line of TextFormat: TextSave & CloseAdd the “Last Name” fieldClick NewSet the Display Name to “Last Name”Logical name: new_lastnameType: Single Line of TextFormat: TextSave & CloseAdd the “Latitude” fieldClick NewSet the Display Name to “Latitude”Logical name: new_latitudeType: Decimal NumberPrecision: 5Minimum Value: -90Maximum Value: 90Save & CloseAdd the “Longitude” fieldClick NewSet the Display Name to “Longitude”Logical name: new_longitudeType: Decimal NumberPrecision: 5Minimum Value: -180Maximum Value: 180Save & CloseAdd the “Location” fieldClick NewSet the Display Name to “Location”Logical name: new_locationType: Single Line of TextFormat: TextSave & CloseAdd the “Phone Number” fieldClick NewSet the Display Name to “Phone Number”Logical name: new_phonenumberType: Single Line of TextFormat: TextSave & CloseAdd the “Priority” fieldClick NewSet the Display Name to “Priority”Logical name: new_priorityType: Option SetChoose Use Existing Option SetOption Set: Service Request PrioritySave & CloseAdd the “Regarding Contact” fieldClick NewSet the Display Name to “Regarding Contact”Logical name: new_regardingcontactType: LookupTarget Record Type: ContactRelationship Name: new_specialrequest_regardingcontactSave & CloseAdd the “Regarding Lead” fieldClick NewSet the Display Name to “Regarding Lead”Logical name: new_regardingleadType: LookupTarget Record Type: LeadRelationship Name: new_specialrequest_regardingleadSave & CloseAdd the “Scheduled Date” fieldClick NewSet the Display Name to “Scheduled Date”Logical name: new_scheduleddateType: Date and TimeFormat: Date and TimeSave & CloseAdd the “Incident Date” fieldClick NewSet the Display Name to “Incident Date”Logical name: new_incidentdateType: Date and TimeFormat: Date and TimeSave & CloseAdd the “Service Request” fieldClick NewSet the Display Name to “Service Request”Logical name: new_servicerequestType: LookupTarget Record Type: Service RequestRelationship Name: new_specialrequest_servicerequestSave & CloseAdd the “Service Request Number” fieldClick NewSet the Display Name to “Service Request Number”Logical name: new_servicerequestnumberType: Single Line of TextFormat: TextSave & CloseAdd the “Service Status” fieldClick NewSet the Display Name to “Service Status”Logical name: new_servicestatusType: Option SetChoose Use Existing Option SetOption Set: Service StatusSave & CloseAdd a (custom) Description fieldClick NewSet the Display Name to “Description”Logical name: new_descriptionType: Multiple Lines of TextSave & CloseFrom the Special Request entity you have just created (either the window that is still open or, if you closed it – by navigating to the entity in the solution window) Click Forms; it is now time to create the CRM form that will be used to render the service request on the portal.Open the Main Information FormPlace all of the fields that you created earlier onto the form. Place the Location and Description fields in the “General” section of the “General” Tab.Click on the location field and click Change PropertiesClick on the Formatting Tab and click Two Columns, then click OKClick on the description field and click Change PropertiesClick on the Formatting Tab and click Two ColumnsGive the field four rows, then click OKAdd the Priority, Scheduled Date, and Closed Date fields to the General sectionCreated a new section called “Contact Details”Select the “General” tabClick the Insert tabClick Two ColumnsClick on the new section to select itOn the home tab, click Change PropertiesSet the label to “Contact Details”Click “Show the label of this section on the formClick “Show a line at the top of the section”Click OKAdd the First Name, Last Name, Email Address, Regarding Contact and Phone Number fields to the Contact Details Section you just createdNote that we have not added the Service Request, Service Request Number, Latitude, and Longitude fields on the form. These may be placed in the header or footer. To edit the header, on the Home tab, click “header”. To edit the footer, on the home tab, click “footer”Click SaveNow Click Save As and Name it Web Form – we will not customize it to suit what is needed on the portalRemove the Notes Tab form the FormRemove or Hide the following fields from the form (to hide a field, right-click on it and uncheck “Visible by Default” and check “field is read only”):PriorityScheduled Date and Closed DateRegarding ContactPublish all CustomizationsThe first step in this process is done, we now need to complete exercise 3 before the new service request type is surfaced on the portal.Exercise 3: Create the Web Form and Service Request TypeIn the main CRM navigation console, click SettingsUnder the “portals” subsection, navigate to “Service Request Types”Click NewEnter all the fields for the Service Request Type definition:Name: Special RequestEntity Name: Special Request (new_specialrequest)Auto Numbering Definition: Service Request NumberPrimary Field Name: new_nameService Request Field Name: new_servicerequestService Request Number Field Name: new_servicerequestnumberService Status Field Name: new_servicestatusPriority Field Name: new_priorityIncident Date Field Name: new_incidentdateScheduled Date Field Name: new_scheduleddateClosed Date Field Name: new_closeddateLocation Field Name: new_locationLatitude Field Name: new_latitudeLongitude Field Name: new_longitudeContact/Lead Behavior: Create ContactRegarding Contact Field Name: new_contactFirst Name Field Name: new_firstnameLast Name Field Name: new_lastnameEmail Field Name: new_emailPhone Number Field Name: new_phonenumberClick the Web Form lookup WindowClick NewEnter “Special Request Web Form”Set “Start New Session On Load” to trueClick SaveClick the Start Step Lookup windowClick NewGive the Step the following Fields:Name: Load Special Request Web FormWeb Form: Special Request Web FormType: Load FormTarget Entity Logical Name: Special Request (new_specialrequest)Mode: InsertForm Name: Web FormClick SaveClick the Next Step Lookup WindowClick NewGive the Step the following Fields:Name: Load Success MessageWeb Form: Special Request Web FormType: Load FormTarget Entity Logical Name: Special Request (new_specialrequest)User Control Path: ~/Areas/Service311/Controls/WebFormServiceRequestSuccess.ascxSource Type: Result From Previous StepMove Previous Permitted: FalseSave & CloseClick OKSave & CloseClick OKWe now need to associate the Web Form with a web pageClick Web Pages on the left-hand side navigationClick Add New Web PageGive the Web Page the following Attributes:Name: Special RequestWebsite: Government PortalPartial Url: special-requestPage Template: Web FormPublishing State: PublishedWeb Form: Special Request Web FormParent Page: Service Requests ListingSave & CloseClick OKSave & CloseThe only step remaining before the service request can be surfaced on the portal is to register the Plugin using the Plugin registration Tool, available with the Microsoft CRM SDK:Download the latest Microsoft CRM SDK and installUnder your CRM SDK install folder, navigate to sdk > tools > pluginregistration Open pluginregistrationtool.sln in VS 2012Rebuild allNavigate to the bin > Debug folder and run PluginRegistration.exeUse the following connection information to navigate to your CRM org:Label: New ConnectionEnter your Discovery URL; to find this URLOpen IENavigate to the URL of the CRM trial you created in preparation for this training course and log inNavigate to Settings > Customizations > Developer resources > Service EndpointsUnder Discovery Service you will find a URL; in Websitecopy.exe choose from the dropdown the URL that matches your discovery URL. For example your credentials and click NextDouble-Click on your CRM Organization on the left-hand side navigationLocate the Adxstudio.Xrm.Plugins.Service311 plugin assemblyExpand this assembly and select the Adxstudio.Xrm.Plugins.Service311.CustomServiceRequestGeoAsyncPluginSelect Register > Register New StepFill in the following fields:Message: CreatePrimary Entity: new_specialrequestChoose Post-operation for the Pipeline stage of executionChoose Asynchronous as the execution modeCheck “Delete AsyncOperation if StatusCode = Successful”Select Register > Register New StepFill in the following fields:Message: UpdatePrimary Entity: new_specialrequestChoose Post-operation for the Pipeline stage of executionChoose Asynchronous as the execution modeCheck “Delete AsyncOperation if StatusCode = Successful”Select the Adxstudio.Xrm.Plugins.Service311.NewCustomServiceRequestPluginSelect Register > Register New StepFill in the following fields:Message: CreatePrimary Entity: new_specialrequestChoose Pre-operation for the Pipeline stage of executionChoose Synchronous as the execution modeSelect the Adxstudio.Xrm.Plugins.Service311.UpdateCustomServiceRequestPluginSelect Register > Register New StepFill in the following fields:Message: UpdatePrimary Entity: new_specialrequestChoose Post-operation for the Pipeline stage of executionChoose Synchronous as the execution modeWe can now actually TEST our service request!Rebuild/Refresh the cache of Government PortalNavigate to the portal in your browser and sign in as System AdministratorCreate a Special request, just like you did in exercise 1 of this chapter.Chapter 14: Portal StructureExercise 1: Add forums to Basic PortalIn this exercise, we will add forums to basic portal.In CRM, navigate to PortalsOpen up the Basic PortalNavigate to Page TemplatesClick Add New Page TemplateGive the Page Template the following attributes:Name: ForumWebsite: Basic PortalRewrite Url: ~/Areas/Forums/Pages/Forum.aspxClick Save & CloseClick Add New Page TemplateGive the Page Template the following attributes:Name: Forum ThreadWebsite: Basic PortalRewrite Url: ~/Areas/Forums/Pages/ForumThread.aspxClick Save & ClosePortal:Rebuild the MasterPortal projectNavigate to the PortalLog in as administrator if you are not already logged in.Navigate to the home page by clicking the house icon in the primary navigationLocate the front-side editing panel on the upper-right hand cornerClick New > Child PageGive the page the following attributes:Name: ForumsPartial URL: forumsPage Template: PagePublishing State: PublishedComment Policy: NoneClick SaveYou will now be redirect to the Forums Page. Before you do anything with this page, add a Web Link to the Primary NavigationClick the Edit button that appears when you mouse over the primary navigation Add a new Web Link by clicking the “+” iconAttributes:Name: ForumPage: ForumsPublishing State: PublishedClick SaveOn the “Forums” page, click New > Child ForumGive the new forum the following attributes:Name: Example ForumPartial URL: example-forumForum Template: ForumThread Template: Forum ThreadPublishing State: PublishedClick SaveYou may now use the forum. Try creating a new thread.Chapter 15: Web ControlsFor these exercises, we will working with the MasterPortal in both Visual Studio and CRM. Exercise 1: Add a new Page TemplateIn this exercise we will add a new Page Template to your web project that can be used for future exercises in this chapter. The Page Template will be a fairly bare-bones template with minimal functionality, which we will add functionality to over the course of this chapter.In VS 2012Open Visual Studio 2012.Select File, Open Project.Navigate to: C:\Program Files\ADXSTUDIO\XrmPortals\6.X.XXXX\Samples.Select AdxstudioPortals.sln then click the Open button.In the Solution Explorer, expand the project: MasterPortalNavigate to the pages folderRight-click on the pages Folder and select Add > New ItemChoose Web Form using Master PageName it Example.aspxChoose WebFormsContent.master as the master page.Inside the “MainContent” <asp:Content> tag; Copy and paste the following markup:<crm:CrmEntityDataSource ID="CurrentEntity" DataItem="<%$ CrmSiteMap: Current %>" runat="server" /><crm:Property DataSourceID="CurrentEntity" PropertyName="Adx_Copy" EditType="html" runat="server" />CRMNavigate to Portals > WebsitesOpen the Basic Portal website entity in the CRMClick Page Templates in the left-hand Side navigationOn the ribbon, click to Add a New Page TemplateComplete the following Fields:Name: Example TemplateWebsite: Basic PortalRewrite URL: ~/Pages/Example.aspxClick SaveClick Web Pages in the left-hand side navigationOn the ribbon, click the Add New Web Page plete the following fields:Name: Example PageWebsite: Basic PortalParent Page: HomePartial Url: examplePage Template: Example TemplatePublishing State: PublishedCopy: This is my example pageSet the value of the Summary field to: This is the SummaryOn the Ribbon, click the Save and Close button to save your changesSelect Web Link SetsOpen Primary NavigationClick once on the Links grid on the formClick the Add New Web Link button on the ribbonName: ExamplePage: Example PagePublishing State: PublishedClick Save & CloseNow rebuild the project in VS2012Navigate to the Portal and navigate to the new example page you just createdExercise 2: Add a Property ControlIn this Exercise we will add a property control which will display an attribute from the current page.Visual StudioNavigate to the Pages folder.Open Example.aspx you created earlier.Copy the following markup:<crm:Property?ID="Summary"?DataSourceID="CurrentEntity"?PropertyName="Adx_Summary" EditType="text"?runat="server"?/>And paste it beneath the <crm:CrmEntityDataSource> control already on the pageNote that the only thing different between this control and the other <crm:Property> control on this page is that the data is being drawn from the summary attribute of the web page rather than the adx_copy.Save and rebuild.Navigate to your portalWhen the Example page loads, you should now see the title you added in Step 2 displayed just above the Example page copy.Note the Datasource that both property controls on the page are data-binding to:<crm:CrmEntityDataSource ID="CurrentEntity" DataItem="<%$ CrmSiteMap: Current %>" runat="server" />Exercise 3: Add CrmHyperLink and Snippet controlsIn the exercise, we will use the CrnHyperlink control to create a link based on a site marker – one that will not break if the URL of its target page changes. Note that we are setting the text of this link by using the snippet expression builder – we save the usage of the front-side editable Snippet control for the experiement.CRMNavigate to Basic Portal in the CRMCreate the News page as a child page of the home page if you have not already done so (this was done in an earlier exercise) Partial Url: newsClick on the Site Markers navigation item.On the Ribbon, click the Add New Site Marker button. This site marker will specify the destination of the hyperlink that we will be placing on the page template (and the link will always point to that page)Complete the following fields:Name: My NewsWeb Site: Basic PortalPage: NewsOn the Ribbon, click the Save and Close button.Click on the Content Snippets navigation item.On the Ribbon, click the Add New Content Snippet button. This will specify the label on the plete the following fields:Name: My News Link TitleWebsite: Basic PortalType: TextValue: NewsOn the Ribbon, click the Save and Close button.Visual StudioOpen Example.aspx.Add the following markup on the line just below the Adx_Copy <property> control:<crm:CrmHyperLink?ID="NewsLink"?SiteMarkerName="My News"?Text="<%$?Snippet:?My News Link Title,?News?%>"?runat="server"></crm:CrmHyperLink>Save your changes and rebuild the project.Navigate to your basic portal, then navigate to the Example PageWhen the Example page loads, you should now see a News hyperlink just below the home page copy.Click on that link and the News page should display.Experiment1) Add a new snippet to the CRM and add a Snippet control to your page template. Make it front-side editable. Recall that the format of the Snippet Control is as follows:<crm:Snippet SnippetName="MySnippet" Editable="True/False" EditType="html" runat="server"/>2) What are some other uses of Snippets? How about Site Settings? Play around with the expression builders for both and share your results.Exercise 4: Add a Weblinks ControlCreate the web link set in the CRMUnder Basic Portal, Click on the Web Link Sets navigation item.On the Ribbon, click the Add New Web Link Set button.In the Name field, enter: Blogs We Follow.On the Ribbon, click the Save button.Click the Web Links navigation item.On the Ribbon, click the Add New Web Link plete the following fields:Name: Mitch’s BlogWeb Link Set: Blogs We FollowWebsite: Basic PortalExternal Url: State: PublishedDisplay Order: 1Open in New Window: YesLeave the remainder of the fields at their default values.On the Ribbon, click the Save and Close button.On the Ribbon, click the Add New Web Link plete the following fields:Name: Basic Portal HomepageWeb Link Set: Blogs We FollowWebsite: Basic PortalPage: HomePublishing State: PublishedDisplay Order: 2Open in New Window: NoLeave the remainder of the fields at their default values.On the Ribbon, click the Save and Close button.Visual StudioNavigate to the Pages folder.Open Example.aspx.Copy and paste the following into the SidebarContent <asp:Content> tag:<crm:WebLinks WebLinkSetName="Blogs We Follow" CssClass="navigation" runat="server" />Save and rebuild the project. Navigate to the Portal.Navigate to the example page, and when it loads you should now see a second set of links on the right side of the page.Exercise 5: Add a CrmSiteMapChildView ControlIn this exercise, we will add a CrmSiteMapChildView which will render out all child pages of the current page. You will need to add child pages to the current page in order to see any.Visual StudioNavigate to the Basic Portal project.Open Example.aspxWe will use a CrmSiteMapChildView to render the child nodes of the current entity of the site map (the current web page). The layout of the rendered nodes will be determined by the Item Template that we use.Add the following code within the “ContentBottom” <asp:Content> tag:<crm:CrmSiteMapChildView runat=”server">????????<LayoutTemplate>????????????<div?class="navigation?frame">????????????????<ul>????????????????????<asp:PlaceHolder?ID="ItemPlaceHolder"?runat="server"?/>????????????????</ul>????????????</div>????????</LayoutTemplate>????????<ItemTemplate>????????????<li>????????????????<asp:HyperLink?NavigateUrl='<%#?Eval("Url")?%>'?Text='<%#?Eval("Title")?%>'runat="server"?/>????????????????<crm:CrmEntityDataSource?ID="ChildEntity"?DataItem='<%#?Container.DataItem?%>'runat=“server”?/>????????????????<crm:Property? ?DataSourceID="ChildEntity"?PropertyName="Adx_Summary,Adx_Description"EditType="html"runat="server"?/>????????????</li>????????</ItemTemplate>????</crm:CrmSiteMapChildView>Rebuild the project. Navigate to the PortalWhen the example page is displayed, you should see hyperlinks and descriptions for each of the pages that are considered children of the Example page. To Begin, you likely won’t have any, so try adding some using front-side editing.Exercise 7: Add a CrmMetadataDataSource controlVisual StudioNavigate to the Basic Portal project. In this exercise we will be binding a drop down list to our CrmMetadataDataSourceOpen Example.aspxInsert the following code within the “ContentBottom” <asp:Content> tag:<crm:CrmMetadataDataSource?ID="SatisfactionSource"runat="server"?AttributeName="customersatisfactioncode"????????EntityName="incident"?SortExpression=“Label?DESC”?/><asp:LabelAssociatedControlID="Satisfaction"?runat="server"?Text="Satisfaction"?/><asp:DropDownList?ID="Satisfaction"?runat="server"DataSourceID=“SatisfactionSource"DataTextField="OptionLabel"?DataValueField="OptionValue"?/>Build the project. Navigate to the PortalWhen the home page is displayed, you should see a drop-down list containing customer satisfaction codes from the Case entity within CRM.Chapter 16: Managed FormsExercise 1: Edit a CRM Form for leadIn this exercise, we will set up a CRM form which we will later use to demonstrate the functionality for the CrmEntityFormView control, the Entity Form feature, and the Web Form feature.Please perform the following:In CRM, first we will create the CRM form itself:Open Internet Explorer and navigate to your CRM online trial orgNavigate to the Settings Area of the Site MapClick CustomizationsClick Customize the SystemSelect Lead from the list of entities on the left navigation of the solution editor window.Click FormsOpen the form titled Web FormClick to Save As…Name the form New Contact Us FormRemove the following fields from the form: Street 1, City, State/Province, ZIP/Postal Code, Country/Region, DescriptionSave and Close the form again.Reorder the forms so that the new form you create is not the default form:Click Form OrderClick Main Form SetMove the newly form to the bottom of the listClick OKClick Publish All Customizations – if this option isn’t shown, click to “information on the left-hand side of the main solution windowExercise 2: Create a Managed Form on the PortalIn this exercise, we will utilize the CrmEntityFormView control to render our Contact Us form on the portal.Navigate to Portals – we will now add the page to the website that will render this formOpen the Basic Portal website.Create a new Page Template for your form:Click Page TemplatesClick NewSpecify the Name as Managed Forms Contact UsWebsite: Basic PortalSpecify the Rewrite URL as ~/Pages/CrmEntityFormViewContactUs.aspx (we will create this in the web project later)Click Save & CloseCreate a new Web Page using this template:Click Web PagesClick NewSpecify the Name as Managed Forms Contact UsSelect the appropriate WebsiteSelect the Home page as the Parent PageSpecify managed-forms-contact-us as the partial URLSelect the Managed Forms Contact Us Page Template created earlierSelect Published as the publishing stateClick Save & CloseNavigate to Web Link SetsClick Primary NavigationClick Web LinksClick NewGive the web link the follow values:Name: Managed Contact UsPage: Managed Forms Contact UsPublishing State: PublishedSave & CloseIn Visual StudioOpen Visual Studio 2012.Select File, Open Project.Navigate to: C:\Program Files\ADXSTUDIO\XrmPortals\6.X.XXXX\Samples.Select AdxstudioPortals.sln then click the Open button.In the Solution Explorer, expand the project: MasterPortal.Create a new Web Form using Master Page in the ~/pages folderUse the WebForms.master pageSave the file as “CrmEntityFormViewContactUs.aspx” in Pages folder contained in the root of the project.Replace the markup of the page with the following:<asp:Content ContentPlaceHolderID="Head" runat="server"><link rel="stylesheet" href="~/css/webforms.css" /></asp:Content><asp:Content ContentPlaceHolderID="MainContent" ViewStateMode="Enabled" runat="server"><asp:Panel ID="ContactForm" CssClass="crmEntityFormView frame" runat="server" Visible="true"><adx:CrmDataSource ID="WebFormDataSource" runat="server" /><adx:CrmEntityFormView runat="server" ID="FormView" EntityName="lead" FormName="New Contact Us Form" DataSourceID="WebFormDataSource" OnItemInserted="OnItemInserted"></adx:CrmEntityFormView></asp:Panel><asp:Panel ID="ConfirmationMessage" runat="server" Visible="false"><crm:Snippet runat="server" SnippetName="ContactUs/ConfirmationMsg" DefaultText="Thank you. Your message has been successfully submitted." EditType="html" /></asp:Panel></asp:Content>Also add the following using Statements, to the using declarations at the top of the code-behind:using Adxstudio.Xrm.Web.UI.WebControls; using Microsoft.Xrm.Portal.Web.UI.WebControls;Now add the following method to the code behind. This event handler is triggered when the form has successfully inserted the new record upon form submission:protected void OnItemInserted(object sender, CrmEntityFormViewInsertedEventArgs e){ContactForm.Visible = false;ConfirmationMessage.Visible = true;}Build the project.Let’s try out the form in the portal:Navigate to the Basic Portal. Navigate to the Managed Form Contact Us page on the portal. You should now see a form resembling the one you created in CRM.Fill in the formFirst name: JohnLast Name: DoeRemaining values can be whatever you wishCRM:View the Submitted Leads in the CRM Navigate to SalesClick LeadsFind the John Doe record and open itNote the lead created matches the data previously entered though the portal.Chapter 17: Managed ListsExercise 1: Add a CrmDataSource ControlVisual StudioOpen the Basic Portal ProjectOpen Example.aspxWe will use fetchXml to establish our data source: a CRM query. We will then databind our gridview to the results of this queryEnter the following within the “ContentBottom” <asp:Content> tag:<adx:CrmDataSource ID="AccountDataSource" runat="server">????????<FetchXml>????????????<fetch?version="1.0"?output-format="xml-platform"?mapping="logical"?distinct="false">????????????????<entity?name="account">????????????????????<attribute?name="name"?/>????????????????????<attribute?name="address1_city"?/>????????????????????<attribute?name="telephone1"?/>????????????????????<filter?type=“and”>????????????????????????<condition?attribute="statecode"?operator="eq"?value="0"?/>????????????????????</filter>????????????????</entity>????????????</fetch>????????</FetchXml>????</adx:CrmDataSource>????<asp:GridView? runat="server"?DataSourceID="AccountDataSource"?AutoGenerateColumns="False"????????AllowSorting="True"?AllowPaging="True" PageSize="5">????????<Columns>????????????<asp:BoundField?DataField='name'?HeaderText="Name"?SortExpression="name"?/>????????????<asp:BoundField?DataField='address1_city'?HeaderText="City"?/>????????????<asp:BoundField?DataField='telephone1'?HeaderText="Telephone"?/>????????</Columns>????</asp:GridView>Rebuild the project. Navigate to the PortalOn the Example page, you should see a GridView showing the name, city, and phone number of all of the active Accounts within CRMExercise 3: Render a grid using the SavedQueryColumnsGenerator Open Visual Studio 2012.Select File, Open Project.Navigate to: C:\Program Files\ADXSTUDIO\XrmPortals\6.X.XXXX\Samples.Select AdxstudioPortals.sln then click the Open button.In the Solution Explorer, expand the project: MasterPortal.Create a new Web Form using Master Page in the ~/pages folderUse the WebForms.master pageName it LeadQueryView.aspxReplace the markup of the page with the following:<asp:Content ContentPlaceHolderID="MainContent" ViewStateMode="Enabled" runat="server"><asp:GridView ID="LeadList" CssClass="table table-bordered table-striped" runat="server"></asp:GridView></asp:Content>Change the class definition of the page so that it inherits from PortalPage:public partial class LeadQueryView : PortalPageAlso add the following using Statements, to the using declarations at the top of the code-behind:using Adxstudio.Xrm.Web.UI;using Adxstudio.Xrm.Cms;Add the following Code to the Page_Load method:var leads = ServiceContext.LeadSet;var columnsGenerator = new SavedQueryColumnsGenerator(ServiceContext, "lead", "All Leads");LeadList.DataKeyNames = new[] { "leadid" };LeadList.DataSource = columnsGenerator.ToDataTable(leads);LeadList.ColumnsGenerator = columnsGenerator;LeadList.DataBind();Build the project.In CRM:Navigate to Portals > WebsitesOpen the Basic Portal website entity in the CRMClick Page Templates in the left-hand Side navigationOn the ribbon, click to Add a New Page TemplateComplete the following Fields:Name: Lead Query ViewWebsite: Basic PortalRewrite URL: ~/Pages/LeadQueryView.aspxClick SaveClick Web Pages in the left-hand side navigationOn the ribbon, click the Add New Web Page plete the following fields:Name: Lead ListWebsite: Basic PortalParent Page: HomePartial Url: lead-listPage Template: Lead Query ViewPublishing State: PublishedOn the Ribbon, click the Save and Close button to save your changesSelect Web Link SetsOpen Primary NavigationClick once on the Links grid on the formClick the Add New Web Link button on the ribbonName: LeadsPage: Lead ListPublishing State: PublishedDisplay Order: 4Click Save & CloseNow rebuild the project in VS2012Navigate to the Portal and navigate to the new example page you just createdExercise 4: Add Edit capability to your grid using Site Markers and an Entity FormIn this exercise, we are going to build on what we’ve done and add edit capability to our grid. We will do so by using the Entity Form feature and creating a web page with an entity form in the CRM. We will then hook this up via a site marker and linking the rows of our grid to this site maker, passing the ID of the element to the form which will allow us to edit.In CRM:Navigate to Portals >Websites > Basic PortalClick Web PagesCreate a new Web Page containing the Entity Form for displaying a case:Name:Lead FormParent Page: Lead ListPartial Url: view-leadPage Template: PagePublishing State: PublishedOpen The Entity Form lookup windowIn the lookup window, click NewWe are now setting up the Entity Form. Give it the following data:Name: Lead FormEntity Name: Lead (lead)Form Name: New Contact Us FormMode: EditRecord Source Type: Query StringRecord ID Query String Parameter Name: idClick Save & CloseClick OK to set the Entity Form on the web pageClick SaveClick Site MarkersClick Add New Site MarkerSet the Name to “Lead Details”Set the Website to Basic PortalEnsure the Page is set to Lead FormSave & CloseIn VS 2012Open Visual Studio 2012.Select File, Open Project.Navigate to: C:\Program Files\ADXSTUDIO\XrmPortals\6.X.XXXX\Samples.Select AdxstudioPortals.sln then click the Open button.In the Solution Explorer, expand the project: MasterPortal.Open LeadQueryView.aspx and then navigate to its code behindAlso add the following using Statements, to the using declarations at the top of the code-behind:using Microsoft.Xrm.Portal.Web;Underneath the Page_Load method, add the following methods:protected void LeadList_OnRowDataBound(object sender, GridViewRowEventArgs e){if (e.Row.RowType != DataControlRowType.DataRow){return;}var dataKey = LeadList.DataKeys[e.Row.RowIndex].Value;e.Row.Cells[1].Text = string.Format(@" <a href=""{0}"" >{1}</a>",LeadDetailsUrl(dataKey),e.Row.Cells[1].Text);}protected string LeadDetailsUrl(object id){var page = ServiceContext.GetPageBySiteMarkerName(Website, "Lead Details");var url = new UrlBuilder(ServiceContext.GetUrl(page));url.QueryString.Set("id", id.ToString());return url.PathWithQueryString;}Now view the markup and change the GridView control to the following:<asp:GridView ID="LeadList" OnRowDataBound="LeadList_OnRowDataBound" CssClass="table table-bordered table-striped" runat="server"></asp:GridView>Save all and rebuild the projectNavigate to the Portal and Sign InNavigate to your case view. Note that you can now click the id of the case and view the case form in edit mode!ExperimentAdd a “Create new” Button to the page so that you can click and create a new case!Chapter 18: Portal Development BasicsExercise 1: Query CRM using early-bound classesIf you have already done the chapter 15 exercises, open the Example.aspx page you created earlier, and skip to Step 2. Otherwise complete the following:Open Visual Studio 2012Select File, Open ProjectNavigate to: C:\Program Files\ADXSTUDIO\XrmPortals\6.X.XXXX\Samples.Select AdxstudioPortals.sln then click the Open buttonIn the Solution Explorer, expand the project: MasterPortalCreate a new Web Form using Master Page in the ~/pages folderUse the WebForms.master pageName it Example.aspxInside the “MainContent” <asp:Content> tag; copy and paste the following markup:<asp:Label ID="FirstLeadLabel" runat="server"></asp:Label>Change the class definition of the page so that it inherits from PortalPage:public partial class Example : PortalPageAdd the following Code to the Page_Load method:var leads = XrmContext.LeadSet;var firstLead = leads.FirstOrDefault();FirstLeadLabel.Text = firstLead.FullName;Save all.In CRM:Create the corresponding Page Template and Web Page in the CRM, fi you did not already do so in the Chapter 15 exercises. If you did the exercises in chapter 15, skip this step and go to step 8.Navigate to Portals > WebsitesOpen the Basic Portal website entity in the CRMClick Page Templates in the left-hand Side navigationOn the ribbon, click to Add a New Page TemplateComplete the following Fields:Name: Example TemplateWebsite: Basic PortalRewrite URL: ~/Pages/Example.aspxClick SaveClick Web Pages in the left-hand side navigationOn the ribbon, click the Add New Web Page plete the following fields:Name: Example PageWebsite: Basic PortalParent Page: HomePartial Url: examplePage Template: Example TemplatePublishing State: PublishedCopy: This is my example pageSet the value of the Summary field to: This is the SummaryOn the Ribbon, click the Save and Close button to save your changesSelect Web Link SetsOpen Primary NavigationClick once on the Links grid on the formClick the Add New Web Link button on the ribbonName: ExamplePage: Example PagePublishing State: PublishedDisplay Order: 3Click Save & CloseNow rebuild the project in VS2012Navigate to the Portal and navigate to the new example page you just createdExperimentCurrently you are render the name of the first lead that appears in the query but you are not performing any actions on this lead. Place a button in the markup of the page. Add a button click handler that takes text of your choice to change the first name of the Lead. You can draw this string value from a textbox or hard-code it. Because you can dot-though it should be easy to determine that this will involve code that looks like this:firstLead.FirstName = chosenName;Furthermore, you can save your changes to the lead record using the following:XrmContext.UpdateObject(firstLead);XrmContext.SaveChanges();Practice more CRM queries and more CRUD operations using the auto-generated code classes. You ability to dot-through affords you great speed in development. Play around with the options.Exercise 2: Query CRM using late-bound methodsOpen Example.aspxAdd the following Code to the Page_Load method:var dynamicLeads = ServiceContext.CreateQuery("lead");var firstDynamicLead = dynamicLeads.FirstOrDefault();FirstLeadLabel.Text = firstDynamicLead.GetAttributeValue<string>("fullname");Save all.When you rebuild the project and reload the page, you will notice it will work the same way as before – we are performing the exact same set of operations, except we are using late-bound dynamic methods now. ExperimentIn the experiment for the previous exercise, we added an additional CRUD operation to the lead record – we set it’s name using the accessor property right on the early bound class. For this experiment, please do the same thing, but this time you will need to do this dynamically using the following:firstDynamicLead.Attributes["firstname"]= chosenName;Now try using a site setting to set the last name of the lead upon the button being clicked – just like you set the first name, but instead of hard-coding what you set the name to, you will create a site setting in the CRM called “firstLead/LastNameSetTo” or something to that effect, and you will use the ServiceContext to get the value of this site setting and set the lead’s last name to whatever the value of this site setting is set to in the CRM using the following extension method:var chosenLastName = ServiceContext.GetSiteSettingValueByName(Website, "firstLead/LastNameSetTo");Note that you will need to include the following using statement:using Adxstudio.Xrm.Web.Cms;Exercise 3: Add a Comment ControlCRMNavigate to Portals > Websites > Basic PortalClick on the Web Pages navigation link on the left-hand sideOpen Example Page that you created earlierChange the Comment Policy to Open.Visual StudioOpen Visual Studio 2012.Select File, Open Project.Navigate to: C:\Program Files\ADXSTUDIO\XrmPortals\6.X.XXXX\Samples.Select AdxstudioPortals.sln then click the Open button.In the Solution Explorer, expand the project: MasterPortal.Navigate to the Pages folder.Open Example.aspx you created earlier.Add the following declaration:<%@?Register?src="~/Controls/Comments.ascx"?tagname="Comments"?tagprefix="adx"?%>In the location where you would like your page rating control displayed, add the following:<adx:Comments?RatingType="vote"?EnableRatings="true"?runat="server"?/>Rebuild the project and test the portal.Exercise 4: Add a Rating ControlCRMNavigate to Portals > Websites > Basic PortalClick on the Web Pages navigation link on the left-hand sideOpen Example Page that you created earlierChange the Comment Policy to Open.Visual StudioOpen Visual Studio 2012.Select File, Open Project.Navigate to: C:\Program Files\ADXSTUDIO\XrmPortals\6.X.XXXX\Samples.Select AdxstudioPortals.sln then click the Open button.In the Solution Explorer, expand the project: MasterPortal.Navigate to the Pages folder.Open Example.aspx you created earlier.Open your page template and add the following declaration:<%@ Register src="~/Controls/MultiRatingControl.ascx" tagname="MultiRatingControl" tagprefix="adx" %>In the location where you would like your page rating control displayed, add the following:<adx:MultiRatingControl ID="MultiRatingControl" RatingType="rating" runat="server" />Rebuild the project and test the portal.Chapter 19: Ads and PollsExercise 1: Add an Advertisement to the Basic PortalCRMNavigate to the Basic Portal Website EntityClick the Ad Placement navigation link.On the Ribbon, click the Add New Ad Placement button.Enter the following properties:Name: Fine BooksOn the Ribbon, click the Save button.Click the Ads navigation link.On the Ribbon, click the Add Existing Ad button.When the Lookup dialog is displayed, click the New plete the following fields:Name: Fine BooksWebsite: Basic PortalPublishing State: PublishedRedirect URL: in New Window: CheckedTitle: Fine BooksCopy: Fine books and sundriesOn the Ribbon, click the Save and Close button.When you return to the Lookup dialog, click the OK button.Visual StudioOpen Example.aspx.Insert the following control into the MainContent content control:<adx:AdPlacement?ID="MainAd"?PlacementName="Fine?Books"?runat="server"></adx:AdPlacement>Save and Run the project.When the Basic Portal home page is displayed, you should see an advertisement for Fine Books located at the bottom of the content area.Exercise 2: Add an Poll to the Basic PortalCRMClick the Poll Placement navigation link.On the Ribbon, click the Add New Poll Placement button.Enter the following properties:Name: Installation TimeframeThe remaining fields are fine with their default values.On the Ribbon, click the Save button.Click the Polls navigation link.On the Ribbon, click the Add Existing Poll button.When the Lookup dialog is displayed, click the New plete the following fields:Name: Installation TimeframeQuestion: When will you be installing Dynamics CRM 2011?Submit button label: VoteOn the Ribbon, click the Save button.Click the Options navigation link.On the Ribbon, click the Add New Poll Options plete the following properties:Name: ImmediatelyAnswer: ImmediatelyOn the Ribbon, click the Save and New plete the following properties:Name: 6 monthsAnswer: 6 monthsOn the Ribbon, click the Save and New plete the following properties:Name: 1 yearAnswer: 1 yearOn the Ribbon, click the Save and Close button.On the Ribbon, click the Save and Close button.When you return to the Lookup dialog, click the Ok button.Visual StudioOpen Example.aspx.Insert the following control into the MainContent content control:<adx:PollPlacement?ID="Polls"?PlacementName="Installation?Timeframe"?runat="server"></adx:PollPlacement>Save and Run the project.When the Basic Portal home page is displayed, you should see an Installation Timeframe poll located at the bottom of the content areChapter 20: MVCExercise 1: Use the Attribute HelpersIf you have already done the chapter 15 exercises, open the Example.aspx page you created earlier, and skip to Step 2. Otherwise complete the following:Open Visual Studio 2012.Select File, Open Project.Navigate to: C:\Program Files\ADXSTUDIO\XrmPortals\6.X.XXXX\Samples.Select AdxstudioPortals.sln then click the Open button.In the Solution Explorer, expand the project: MasterPortal.Create a new Web Form using Master Page in the ~/pages folderUse the WebForms.master pageName it Example.aspxChange the class definition of the page so that it inherits from PortalPage:public partial class Example : PortalPageAdd the following declaration to the top of the markup:<%@ Import namespace="Adxstudio.Xrm.Web.Mvc.Html" %>Add the following to the markup inside the MainContent content placeholder:MVC Attribute Control:<%= Html.Attribute("adx_copy") %>Save all.In CRM:Create the corresponding Page Template and Web Page in the CRM, fi you did not already do so in the Chapter 15 exercises. If you did the exercises in chapter 15, skip this step and go to step 8.Navigate to Portals > WebsitesOpen the Basic Portal website entity in the CRMClick Page Templates in the left-hand Side navigationOn the ribbon, click to Add a New Page TemplateComplete the following Fields:Name: Example TemplateWebsite: Basic PortalRewrite URL: ~/Pages/Example.aspxClick SaveClick Web Pages in the left-hand side navigationOn the ribbon, click the Add New Web Page plete the following fields:Name: Example PageWebsite: Basic PortalParent Page: HomePartial Url: examplePage Template: Example TemplatePublishing State: PublishedCopy: This is my example pageSet the value of the Summary field to: This is the SummaryOn the Ribbon, click the Save and Close button to save your changesSelect Web Link SetsOpen Primary NavigationClick once on the Links grid on the formClick the Add New Web Link button on the ribbonName: ExamplePage: Example PagePublishing State: PublishedDisplay Order: 3Click Save & CloseNow rebuild the project in VS2012Navigate to the Portal and navigate to the new example page you just created.ExperimentExperiment with the different ways to use the Attribute Helpers:<%= Html.Attribute(Html.Website(), "adx_name") %><%= Html.Attribute<Xrm.Adx_webpage>(p => p.Adx_name) %><%= Html.TextAttribute("adx_title") %><%= Html.HtmlAttribute("adx_summary") %><%= Html.AttributeLiteral("adx_copy") %>Exercise 2: Use the Site Setting HelpersIN CRMNavigate to Portals > Websites > Basic PortalNavigate to Site SettingsCreate a new Site Setting:Name: Example Boolean SettingValue: true or falseSave & CloseIn Vs 2012Open Example.aspxAdd the following to the markup:<% if (Html.BooleanSetting("Example Boolean Setting") ?? false) %><% { %><p> The Boolean Setting is set to true!</p><% } else { %><p> The Boolean Setting is set to false! </p><% } %>Save allRebuild the projectBrowse to the portal and open up the example pageExperimentTry creating a setting that takes an integer value and use the Html.IntegerSetting() helper to get and use this value. Exercise 3: Use the Site Marker HelpersIf you have not already done so, you will create a “News” page and a site marker that points to this page. This was completed in a previous exercise. If you have done all exercises up to this point, skip past this step.Navigate to Basic Portal in the CRMCreate the News page as a child page of the home page if you have not already done so (this was done in an earlier exercise) Partial Url: newsClick on the Site Markers navigation item.On the Ribbon, click the Add New Site Marker button. This site marker will specify the destination of the hyperlink that we will be placing on the page template (and the link will always point to that page)Complete the following fields:Name: My NewsWeb Site: Basic PortalPage: NewsOn the Ribbon, click the Save and Close button.In VS 2012, Open Example.aspxAdd the following to the markup of the page, In the “Main Content” content area:<%= Html.SiteMarkerLink("My News") %>Save and rebuild the project then browse to see the resultsExercise 4: Use the Snippet HelpersIn the CRM, open Portals > Websites > Basic PortalNavigate to Content SnippetsCreate a new Content Snippet:Name: Example Content SnippetValue: This is a Snippet.Save & CloseIn VS 2012Open Example.aspxAdd the following to the markup of the page, In the “Main Content” content area:%= Html.TextSnippet("Example Content Snippet") %>Save all, rebuild, and browse to see the results.ExperimentExperiment with different ways to use the Snippet Helpers according to the usages below. You can also create new Content snippets and try different values for those snippets.<%= Html.HtmlSnippet("Example Content Snippet") %><%= Html.Snippet("Example Content Snippet") %><%= Html.SnippetLiteral("Example Content Snippet") %>Exercise 5: Use the Web Link HelpersIn this exercise, we will Utilise the MVC Web Links Helpers to render the links of a Web Link Set in the CRM. If you have not done all the exercises from chapter 15, you may skip this step, as you will be creating a new Web Link Set, which you would have already done in Chapter 15. If you have done this already, skip to Step 2.Under Basic Portal, Click on the Web Link Sets navigation item.On the Ribbon, click the Add New Web Link Set button.In the Name field, enter: Blogs We Follow.On the Ribbon, click the Save button.Click the Web Links navigation item.On the Ribbon, click the Add New Web Link plete the following fields:Name: Mitch’s BlogWeb Link Set: Blogs We FollowWebsite: Basic PortalExternal Url: State: PublishedDisplay Order: 1Open in New Window: YesLeave the remainder of the fields at their default values.On the Ribbon, click the Save and Close button.On the Ribbon, click the Add New Web Link plete the following fields:Name: Basic Portal HomepageWeb Link Set: Blogs We FollowWebsite: Basic PortalPage: HomePublishing State: PublishedDisplay Order: 2Open in New Window: NoLeave the remainder of the fields at their default values.On the Ribbon, click the Save and Close button.In VS 2012Open Example.aspxAdd the following Code to the MainContent content placeholder area:<% foreach (var link in Html.WebLinkSet("Blogs We Follow").WebLinks) %><% { %> <p><%= Html.WebLink(link) %></p><% } %>Save and rebuild the project, then browse to see the result.ExperimentExperiment with different ways to render Web Link Sets. Html.WebLinks is essentially equivalent to the <adx:Weblinks> web control. Html.WebLinksDropdown, on the other hand, gives more advancing rendering of bootstrap dropdowns for sub menus, etc. Play with the different options.Exercise 6: Add an MVC AppIn this exercise, we will create a bare-bones MVC app and anchor it in our portal via a site marker. This App will display an unordered, unstyled list of campaigns and simply output the description of each one. In the experiment, you will get the opportunity to expand on this functionality to create a more fully-featured MVC app.In CRM:Navigate to Marketing Click Campaigns on the left-hand side navigationClick to Create a New CampaignGive the Campaign the following values:Name: My CampaignDescription: This is the description of my CampaignLeave the remainder of the fields at their default valuesClick Save & CloseNavigate to Portals > WebsitesOpen Basic PortalNavigate to Web PagesCreate a new Web Page with the following values:Name: Campaign View AreaWebsite: Basic PortalParent Page: HomePartial Url: campaign-viewPage Template: PagePublishing State: PublishedSave but do not close the formNavigate to Web Links on the left-hand side navigationClick Add New Web LinkGive the Web link the following values:Name: Campaign View AreaWeb Link Set: Primary NavigationPage: Campaign View AreaPublishing State: PublishedSave & CloseNavigate to Site Markers on the left-hand navigationClick Add New Site MarkerGive the Site Marker the following values:Name: Campaign View AreaWebsite: Basic PortalPage: Campaign View AreaSave & CloseWe have a Web page anchored by a site marker that will ‘host’ our MVC App. Let’s now build that MVC in VS 2012Right-Click on the Areas folder in the MasterPortal web projectSelect New > AreaEnter MyCampaigns as the Area NameOpen MyCampaignsAreaRegistration.cs. This file was created when you created your new area. A RegisterArea( ) function should also have been created with an example route already wired up. Include the following Using Statement:using Adxstudio.Xrm.Web.Mvc;Replace the context.MapRoute( ) function with the following code:context.MapSiteMarkerRoute("Campaign View Area","Campaign View Area","{action}/{id}",new { controller = "Campaigns", action = "Index", id = UrlParameter.Optional });Right-click on the Models folder in your new AreaSelect Add > New ItemUnder Code, select ClassName your class CampaignViewModel.csAdd the following declarations to the top of the code file:using Microsoft.Xrm.Sdk;using Xrm;Add the following property to the new view model class you have created:public List<Campaign> Campaigns;Right-click on the Controllers folder in your new AreaSelect Add > ControllerController name: CampaignControllerAdd the following declarations to the top of the file:using Adxstudio.Xrm.Web.Mvc;using Site.Areas.MyCampaigns.Models;using Xrm;Replace the entire Index( ) ActionResult function with the following:public ActionResult Index(){var context = new XrmServiceContext();var campaigns = context.CampaignSet;var viewModel = new CampaignViewModel(){Campaigns = campaigns.ToList()};return View(viewModel);}Right-click on the Views > Shared folder in your AreaSelect New > ViewSet Index as the name of your viewSet your view Engine to ASPX (C#)Choose “Use a layout or master page”For the master page, choose “~/MasterPages/Default.master”Replace the entire contents of the Index.aspx file with the following:<%@ Page Language="C#" MasterPageFile="~/MasterPages/Default.master" Inherits="System.Web.Mvc.ViewPage<Site.Areas.MyCampaigns.Models.CampaignViewModel>" %><%@ OutputCache CacheProfile="User" %><%@ Import Namespace="System.Web.Mvc.Html" %><%@ Import Namespace="Adxstudio.Xrm.Web.Mvc.Html" %><asp:Content runat="server" ContentPlaceHolderID="MainContent"><%= Html.HtmlAttribute("adx_copy") %><ul class="unstyled"><% foreach (var campaign in Model.Campaigns) { %><li><div class="bottom-break"><%= campaign.Description %></div></li><% } %></ul></asp:Content>Save all and Rebuild the project.Brows to your campaign View Area in Basic Portal. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download