D365 PSA: Restrict Project access only to their Project Managers

Out-of-the-box PSA’s Project Manager security role provides complete access to even other Project Managers. But then, what if you want to bring down the access of the Project Managers to their own Projects only?

Remember, access in D365 PSA is provided for Owner (ownerid) field and not Project Manager (msdyn_projectmanager) field.

PSARoleRestrict

Scenario

Now, I don’t want a Project Manager to have access to others Projects and looks like this can’t be controlled from the Security Level perspective, given the Project Manager is a separate field than Owner of the Project.

So, I’ll limit the access to only the User level (the one who created the record would have the access, obviously)

PSARoleRestrict2

But this remove the access from even the Project Managers since they don’t own the Projects. To overcome this, I’ve written a simple plugin to provide access to the Project Manager whenever they are updated by Sharing and giving PMs the access.

For this, I’ve written a plugin code that will grant all permissions to the Project Manager of that Project and I would like to share this with you all to consume it.

GitHub Project

Here’s the GitHub repository I’ve created which has the plugin code and the Unmanaged Solution that contains only the plugin assembly and the registered step –

Link: D365PSA-PMAccessRights

gitProj

The D365 Unmanaged Solution resides here –

unmanagedSoln

This will work in the following scenarios –

  1. When a Project Manager is changed from Person A to Person B, the access rights of Person A will be removed and granted to Person B.
  2. You can even create a trigger field and use an on-demand workflow to set the trigger. This trigger should be included in the filtering attributes of the plugin step to update the existing records.

This will provide access to the Project Manager of the Project automatically apart from the Owner so that they see/access only Projects that concern them
accessGiven

Make sure no other security role is overriding your restricted access.

Hope this helps! 🙂

Advertisement

Search For Privilege Name Using Privilege Id

Really useful!

Passion Dynamics

Quick post on how to search for privilege/permission name using privilege Id. You often in dynamics receive an error like below during your plugins or Web Api requests.:

“user is missing privilege ba09ec92-12c4-4312-ba16-5715c2cbd6da”

looking at the error, its difficult to tell what is the permission missing and on what entity.

Use this approach

All privileges are stored in an entity called privilege : Read more here.
you cannot see this entity in dynamics CRM front-end as its not available however you can easily query this entity using Web Api.

  1. Get web api url of your organization by going to Settings > Customizations > Developer Resources > Web API instance url:

    i.e. https://organizationname.api.crm8.dynamics.com/api/data/v9.1/

  2. Append this url with “privileges?$select=name” and put it in your browser: https://organization.api.crm8.dynamics.com/api/data/v9.1/privileges?$select=name

    1

  3. hit Ctrl+F and search using id:

    1.png

  4. Now we know the id refers to “PrvReadContact”. Go to the security role and assign appropriate read access on…

View original post 5 more words

D365 Quick Tip: Simple & Detailed Mode in Advanced Find

If you ever wanted to refine your Personal Settings and ever came across this setting that asks your to set the default mode in Advanced Find
setting

But didn’t observe the Advanced Find well? Here’s what it does

Simple Mode

As per Advanced Find behavior, the view which you are on is pre-selected in the Advanced Find.

And observe that the query is locked and you actually need to click on Details to expand it or make it editable
simpleMode

And then it expands like this
expanded

Detailed Mode

In Detailed mode, if you click on Advanced Find button, the query will already be in detailed view ready for you to be edited directly without you needed to click on Details as in Simple mode
advancedMode

 

Hope this quick tip saves you that extra bit of second. 🙂

Get SharePoint Document Location link on field on create in D365

I’ve been working on getting the SharePoint Document’s link to get back into D365 but looks like it can’t come back and get tagged to the record it was created from.

I tried to fire off a plugin on SharePoint Document record create, but in vain. Flow didn’t do justice since SharePoint Document entity doesn’t support Change Tracking.

So, I retrieved the Absolute URL of the “SharePoint Document Location” entity on it’s create itself so that I have the link once the record is created. And click that link to open the folder in SharePoint.

Workflow to wait and then fetch

So if you immediately make a call to retrieve the Absolute URL in the plugin code you’ve written on Create won’t work because Absolute URL gets created moments after the actual Location record is created unlike being passed in the execution context.

My approach is to fire the workflow on the create of the SharePoint Document Location record and Wait for 1 minute.

wfBody

After 1 minute, set off the flag to call the plugin and fetch the Absolute URL as shown below –

updateFlag

Retrieve Absolute URL in Plugin

You can use RetrieveAbsoluteAndSiteCollectionUrlRequest message to retrieve the SiteCollection URL and the Absolute URL of the document folder of the record

retrieveAbsolute

 

Working

  1. When you open the Document sub-grid on the record for the first time, a Document Location record is created –
    openForFirst
  2. The workflow designed above will run and fire off the plugin after 1 minute. The plugin will then make the message request go through to get you the Absolute URL as below –
    link2
  3. And probably you can use that link to open up the folder by clicking on the field that has this URL or send it across in email to internal users (whatever suits your requirements)
    linkInField
  4. It will open up the SP folder for that record and will have all the documents you attach in the Document sub-grid on the record.
    spFolder

Hope this helps!

D365 Quick Tip: Bulk Clear field values

A very handy approach for admins and users of Dynamics 365 who want to bulk clean up field values – And just selecting them in Bulk Editing them as shown below doesn’t help!!

So here’s the scenario – You want to clear the selected records for their Credit Score field
containsData

Because primarily, you can commonly put a value in a field using Bulk Edit, but not clear the value.

 

Workaround

What you can do instead, create a quick and simple workflow to clear the field.

  1. Create an On-Demand workflow on Contact entity with an Update step for Contact
    workflowBody
  2. In the Update step, point to the field and then select the Operator on the right hand side to select Clear
    operator
  3. Make sure the Clear appears on the field you want to Bulk Update
    clearField
  4. Once done, save and Activate the workflow. Run on the selected records you want to clear at once
    runWorkflow
  5. The values will now be cleared for these records
    cleared

Hope this helps!

Opt-in for April 2019 Preview Updates

Finally, as scheduled on 1st Feb 2019, April 2019 Preview Updates can now be opted in for your organization.

Opting-in is available for Sandbox, Trail and Production environments.

Opt-In

  1. You can now go to https://admin.powerplatform.microsoft.com/ and look for the Organization on the left hand pane
    pPlatformEnv
  2. Select your Organization, look for Updates section on the bottom or right hand side
    manageOrgs
    Zoomed In
    zoomedManage

  3. Click on Activate now. Be careful, these changes can’t be undone.
    activateNow
  4. Enter your Org name and click Continue
    orgName
  5. And it will take some time to activate
    activating

 

And once you are set, you’ll see that the April 2019 update was applied –

aprilApplied

 

Happy D365’ing!