Wednesday 26 September 2012

Update personal setting for all users

I am working on a project where we are suppose to send an email when ownership of a record is changed, and also on some record when some data is updated but due that we had some information which logged in user has no visibility due to security role, but we want to inform them or update data as a result of some changes done by logged in user.

To achieve there are few plugin written which are running as service account, everything seem working fine except when user's setting is to user email router to send email, in this case the logged in user is in the from however the plugin which is executing is running under service account then user gets plugin exception that he needs to update "Allow other users to send email on his/her behalf", if user sets this option by going to file->option->email tab and selects this check box than plugin executes fine.

however this needs to be done for lots of user on client site, and there is not OOB option which allows system admin to update personal setting for each user.

Solution is to write code and retrieve usersettings record and then update IsSendAsAllowed email for the required users:

Entity Name: UserSettings

Attribute Name: IsSendAsAllowed

Thursday 13 September 2012

Error while deploying crm solution

When I was trying to deploy CRM solution using CRM Develper toolkit, I was getting an error that attribute attribute2 does not exists on entity entity1 though the attribute1 and attribute2 does exists.

Solution, There was a space in attributes list in pre-image i.e. Attributes="attribute1, attribute2", removing the space solved the issue. Scool boy error

Thursday 6 September 2012

Valid email

When sending email for/from system user CRM checks whether "Primary Email-Status" for system user is approved,
for contact "emailaddress1" is considered.

error while updating security permission on secure field

I updated a field and enabled field level security. Then I created a security profile and when tried to update the security field permission I was getting error

"the user does not have read permissions to a secured field"

Solution: Publish All customisation for the solution which has the security profile


http://social.microsoft.com/Forums/en/crmdevelopment/thread/d6f898ba-2be7-4992-8820-44399a45f227

Field-Level Security

Tuesday 4 September 2012

Check wheter dialog is completed succesfully or cancelled



ProcessLogStatus:
    {
        InProgress: 1,
        Succeeded: 2,
        Failed: 3,
        Canceled: 4,
        Waiting: 5
    }


IsDialogCancelled: function (regardingobjectid) {

        var fetchXml = '<fetch mapping="logical" count="1" version="1.0">';
        fetchXml = fetchXml + '<entity name="workflowlog">';
        fetchXml = fetchXml + '<attribute name="status" />';
        fetchXml = fetchXml + '<order attribute="createdon" descending="true" />';
        fetchXml = fetchXml + '<order attribute="stepname" descending="true" />';
        fetchXml = fetchXml + '<filter />';
        fetchXml = fetchXml + '<link-entity name="processsession" from="processsessionid" to="asyncoperationid">';
        fetchXml = fetchXml + '<attribute name="regardingobjectid" />';
        fetchXml = fetchXml + '<filter>';
        fetchXml = fetchXml + '<condition attribute="regardingobjectid" operator="eq" value="' + regardingobjectid + '" />';
        fetchXml = fetchXml + '</filter>';
        fetchXml = fetchXml + '</link-entity>';
        fetchXml = fetchXml + '</entity>';
        fetchXml = fetchXml + '</fetch>';
       
        var service = new crmSOAPService(orgUniqueName, server);
        var processlogstatus = service.Fetch(fetchXml);

        if (processlogstatus != null && processlogstatus.length > 0) {

            if (processlogstatus[0].attributes.status.value == ProcessLogStatus.Canceled) {
               
                return true;

            } else {

                return false;

            }

        } else {
            return false;
        }
    }