Quantcast
Channel: Forum CRM Development
Viewing all 1000 articles
Browse latest View live

CRM 2011 attribute / field issue

$
0
0

I have two forms. Each form has the same field being used. On one form I need two fields to be required on the other form they don't need to be required.

Thank you


newjeep


CRM 2011 onsave javascript error

$
0
0

I get the below error when saving the form:

There was an error with this field's customized event.

Field:crmForm

Event:onsave

Error:Unable to get value of the property'setSubmitMode':object is null or undefined

JS code here:

function Form_onload() {
    //PRICE LIST DEFAULT
    var pricelevel = Xrm.Page.data.entity.attributes.get("pricelevelid").getValue();
    if (pricelevel == null || pricelevel == "" || pricelevel == "undefined") {
        var lookupData = new Array();
        var lookupItem = new Object();
        if (ORG_UNIQUE_NAME == "CRMTEST") {
            lookupItem.id = '{E27C78A6-070C-E211-9F9E-0050568C3D2C}';
        }
        else {
            lookupItem.id = '{4ECEE2C4-E0F7-DA11-A791-000BCD4F5459}';
        }
        lookupItem.entityType = 'pricelevel';
        lookupItem.name = 'LIST';
        lookupData[0] = lookupItem;
        Xrm.Page.getAttribute("pricelevelid").setValue(lookupData);
        Xrm.Page.getAttribute("pricelevelid").setSubmitMode("always");
    }
    //SET REQUIREMENT LEVEL
    Xrm.Page.getAttribute("gtri_contractnameid").setRequiredLevel("required");
    Xrm.Page.getAttribute("gtri_contactid").setRequiredLevel("none");

    //DISABLE FIELDS
    Xrm.Page.ui.controls.get("gtri_reasonforloss").setDisabled(true);
    Xrm.Page.ui.controls.get("estimatedvalue").setDisabled(true);
    Xrm.Page.ui.controls.get("gtri_50pctdate").setDisabled(true);
    Xrm.Page.ui.controls.get("gtri_75pctdate").setDisabled(true);
    Xrm.Page.ui.controls.get("gtri_75pcthwswrevenue").setDisabled(true);
    Xrm.Page.ui.controls.get("gtri_75pcthwswgp").setDisabled(true);
    Xrm.Page.ui.controls.get("gtri_75pctservicesrevenue").setDisabled(true);
    Xrm.Page.ui.controls.get("gtri_75pctservicesgp").setDisabled(true);
    Xrm.Page.ui.controls.get("gtri_90pctdate").setDisabled(true);
    Xrm.Page.ui.controls.get("gtri_100pctdate").setDisabled(true);
    Xrm.Page.ui.controls.get("actualclosedate").setDisabled(true);

    //LOST -- REQUIRE REASON FOR LOSS
    var prob = Xrm.Page.data.entity.attributes.get("gtri_probabilitytoclose").getValue();
    if (prob == 7) {
        Xrm.Page.ui.controls.get("gtri_reasonforloss").setDisabled(false);
        Xrm.Page.getAttribute("gtri_reasonforloss").setRequiredLevel("required");
        Xrm.Page.ui.controls.get("gtri_reasonforloss").setVisible(true);
    }
    else {
        Xrm.Page.ui.controls.get("gtri_reasonforloss").setDisabled(true);
        Xrm.Page.getAttribute("gtri_reasonforloss").setRequiredLevel("none");
        Xrm.Page.ui.controls.get("gtri_reasonforloss").setVisible(false);
    }

    //SET OPP TYPE SETTINGS
    gtri_opportunitytype_onchange();

    //SHAREPOINT IFRAME
    var spfolderpath = Xrm.Page.getAttribute("gtri_spfolderpath").getValue();
    if (spfolderpath == null || spfolderpath == "" || spfolderpath == "undefined") {
        Xrm.Page.getControl("IFRAME_Documents").setSrc("about:blank");
    }
    else {
        Xrm.Page.getControl("IFRAME_Documents").setSrc(spfolderpath);
    }
}
function Form_onsave() {
    Xrm.Page.data.entity.attributes.get("estimatedvalue").setSubmitMode("always");
    Xrm.Page.data.entity.attributes.get("gtri_totalgp").setSubmitMode("always");
    Xrm.Page.data.entity.attributes.get("gtri_probabilitytoclose").setSubmitMode("always");
    Xrm.Page.data.entity.attributes.get("gtri_expectedprojectstart").setSubmitMode("always");
    Xrm.Page.data.entity.attributes.get("gtri_rptuid").setSubmitMode("always");

    //SET CRM PHASE FIELD
    var phaseAttribute = Xrm.Page.getAttribute("stepname");
    var probalitityText = Xrm.Page.getAttribute("gtri_probabilitytoclose").getSelectedOption().text;
    phaseAttribute.setValue(probalitityText);

    //REPLACE INVALID CHARACTERS
    var name = Xrm.Page.getAttribute("name").getValue();
    name = name.replace(' & ', ' and ');
    name = name.replace('&', ' and ');
    name = name.replace('&', '');
    name = name.replace('+', '');
    name = name.replace('~', '');
    name = name.replace('#', '');
    name = name.replace('%', '');
    name = name.replace('*', '');
    name = name.replace('{', '');
    name = name.replace('}', '');
    name = name.replace('\\', '');
    name = name.replace(':', '');
    name = name.replace('<', '');
    name = name.replace('>', '');
    name = name.replace('?', '');
    name = name.replace('/', '');
    name = name.replace('"', '');
    name = name.replace('|', '');
    name = name.replace('"', '');
    name = name.replace('.', '');
    Xrm.Page.getAttribute("name").setValue(name);

    var accountId = Xrm.Page.getAttribute("customerid").getValue()[0].id;
    if (Xrm.Page.context.getServerUrl() == "http://srvdev250/GTRI") {
        var clientURL = "http://srvdev250/GTRI";
    }
    else {
        var clientURL = "https://gtri.gtrint.com";
    }
    var clientURL = Xrm.Page.context.getServerUrl();
    var odataSelect = clientURL + "/xrmservices/2011/OrganizationData.svc/AccountSet?$select=gtri_gtri_class_account/GTRI_name&$expand=gtri_gtri_class_account&$filter=AccountId eq guid'" + accountId + "'";

    $.ajax({
        type: "GET",
        contentType: "application/json; charset=utf-8",
        datatype: "json",
        url: odataSelect,
        beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); },
        success: function (data, textStatus, XmlHttpRequest) {
            // Use only one of these two methods

            // Use for a selection that may return multiple entities
            //ProcessReturnedEntities(data.d.results);

            // Use for a single selected entity
            ProcessReturnedEntity(data.d);

        },
        error: function (XmlHttpRequest, textStatus, errorThrown) { alert('OData Select Failed: ' + odataSelect); }
    });

    function ProcessReturnedEntity(SingleEntity) {
        var singleEntity = SingleEntity;
        var AccountClass = singleEntity.GTRI_name;

        if (Xrm.Page.context.getOrgUniqueName() == "CRMTEST") {
            classDoD = '{1A75742C-070C-E211-9F9E-0050568C3D2C}';
        }
        else {
            classDoD = '{FD907D0B-C461-DF11-BD51-0050569F4744}';
        }
        if (AccountClass == classDoD) {
            // Set the crm checkbox field value
            Xrm.Page.getAttribute("gtri_rptuid").setValue(true);
        }
        else {
            Xrm.Page.getAttribute("gtri_rptuid").setValue(false);
        }

    }
}
function gtri_opportunitytype_onchange() {
    //REQUIRE REASON FOR LOSS FIELD
    var probtoclose = Xrm.Page.data.entity.attributes.get("gtri_probabilitytoclose").getValue();
    if (probtoclose == 7) {
        Xrm.Page.ui.controls.get("gtri_reasonforloss").setDisabled(false);
        Xrm.Page.getAttribute("gtri_reasonforloss").setRequiredLevel("required");
    }
}
function gtri_probabilitytoclose_onchange() {
    // Create variables to capture the "Probability To Close" selected value
    var selectedOptionSet = Xrm.Page.getAttribute("gtri_probabilitytoclose");
    var optionValue = selectedOptionSet.getSelectedOption().value;
    // Function checks to see if the field passed in contains a value and returns true if it does, false if not
    function checkForValue(fieldName) {
        var fieldValue = Xrm.Page.getAttribute(fieldName).getValue();
        //alert(fieldValue);
        if (fieldValue == "" || fieldValue == "undefined" || fieldValue == null) {
            return false;
        }
        else {
            return true;
        }
    }
    // Functions that will be used to set the 50/75/90/100% Date Fields
    function setPercentDate(fieldName) {
        // Create variable to hold today's Date
        var _today = new Date();
        // Set control's value to current date
        Xrm.Page.ui.controls.get(fieldName).setDisabled(false);
        Xrm.Page.getAttribute(fieldName).setValue(_today);
        Xrm.Page.ui.controls.get(fieldName).setDisabled(true);
        Xrm.Page.getAttribute(fieldName).setSubmitMode("always");
    }
    function set75PercentFields() {
        //ENABLE FIELDS
        Xrm.Page.ui.controls.get("gtri_75pcthwswrevenue").setDisabled(false);
        Xrm.Page.ui.controls.get("gtri_75pcthwswgp").setDisabled(false);
        Xrm.Page.ui.controls.get("gtri_75pctservicesrevenue").setDisabled(false);
        Xrm.Page.ui.controls.get("gtri_75pctservicesgp").setDisabled(false);
        //SET VALUES
        Xrm.Page.getAttribute("gtri_75pcthwswrevenue").setValue(Xrm.Page.getAttribute("gtri_hwswmaintrevenue").getValue());
        Xrm.Page.getAttribute("gtri_75pcthwswgp").setValue(Xrm.Page.getAttribute("gtri_hwswmaintgp").getValue());
        Xrm.Page.getAttribute("gtri_75pctservicesrevenue").setValue(Xrm.Page.getAttribute("gtri_servicesrevenue").getValue());
        Xrm.Page.getAttribute("gtri_75pctservicesgp").setValue(Xrm.Page.getAttribute("gtri_servicesgp").getValue());
        //DISABLE FIELDS
        Xrm.Page.ui.controls.get("gtri_75pcthwswrevenue").setDisabled(true);
        Xrm.Page.ui.controls.get("gtri_75pcthwswgp").setDisabled(true);
        Xrm.Page.ui.controls.get("gtri_75pctservicesrevenue").setDisabled(true);
        Xrm.Page.ui.controls.get("gtri_75pctservicesgp").setDisabled(true);
        //FORCESUBMIT FIELDS
        Xrm.Page.getAttribute("gtri_75pcthwswrevenue").setSubmitMode("always");
        Xrm.Page.getAttribute("gtri_75pcthwswgp").setSubmitMode("always");
        Xrm.Page.getAttribute("gtri_75pctservicesrevenue").setSubmitMode("always");
        Xrm.Page.getAttribute("gtri_75pctservicesgp").setSubmitMode("always");
    }
    //LOST -- REQUIRE REASON FOR LOSS
    if (optionValue == 7) {
        Xrm.Page.ui.controls.get("gtri_reasonforloss").setDisabled(false);
        Xrm.Page.getAttribute("gtri_reasonforloss").setRequiredLevel("required");
        Xrm.Page.getControl("gtri_reasonforloss").setVisible(true);
    }
    else {
        // Check if this is a Project Opportunity and set appropriate values based on the "Probability To Close" dropdownlist selection
        if (Xrm.Page.getAttribute("gtri_opportunitytype").getText() == 2) {
            // User selected 50%
            if (optionValue == 3) {
                // Set value for the "50% Date" field
                setPercentDate("gtri_50pctdate");
            }
                // User selected 75%
            else if (optionValue == 4) {
                // Check if the "50% Date" field has a value
                if (Xrm.Page.getAttribute("gtri_50pctdate").getValue() == "" || Xrm.Page.getAttribute("gtri_50pctdate").getValue() == "undefined" || Xrm.Page.getAttribute("gtri_50pctdate").getValue() == null) {
                    // Set value for the "50% Date" field
                    setPercentDate("gtri_50pctdate");
                }
                // Set values for the "75%" fields
                setPercentDate("gtri_75pctdate");
                set75PercentFields();
            }
                // User selected 90%
            else if (optionValue == 5) {
                // Check if we have a 75% date, and if not set the ProbToClose dropdownlist to null and alert the user
                if (checkForValue("gtri_75pctdate") == false) {
                    // Empty the value in the "Probability To Close" dropdownlist
                    Xrm.Page.getAttribute("gtri_probabilitytoclose").setValue(null);
                    // Give user popup alert that this is not allowed
                    alert("You must set the Opportunity to 75% and save the Opportunity before moving forward.");
                }
                else {
                    // Set value for the "90% Date" field
                    setPercentDate("gtri_90pctdate");
                }
            }
                // User selected 100%
            else if (optionValue == 6) {
                // Check if we have a 75% date, and if not set the ProbToClose dropdownlist to null and alert the user
                if (checkForValue("gtri_75pctdate") == false) {
                    // Empty the value in the "Probability To Close" dropdownlist
                    Xrm.Page.getAttribute("gtri_probabilitytoclose").setValue(null);
                    // Give user popup alert that this is not allowed
                    alert("You must set the Opportunity to 75% and save the Opportunity before moving forward.");
                }
                else {
                    // Check if we have a 90% date
                    if (checkForValue("gtri_90pctdate") == false) {
                        // Set value for the "90% Date" field
                        setPercentDate("gtri_90pctdate");
                    }
                    // Set value for the "100% Date" field
                    setPercentDate("gtri_100pctdate");
                }
            }
        }
    }
}

Please help! Thank you

newjeep

SOAP "The credential is blocked." When authenticating using Windows Live ID

$
0
0

Hi I'm connecting to dynamics online using SOAP in C# to add custom entities. The login type being used is a windows live account.

I'm running into an odd error when i try and connect to the server atm, it seems to have just start with little explanation.

When i try and authenticate using windows live I get an xml responce [posted at end] containing an error saying"The credential is blocked."However when i try and connect with a fake username i know is invalid i get "The entered and stored passwords do not match."

I've checked my xml responses and my device is registering fine. Its just the authenticating bit.

Is there a chance the crm has blocked this log in somehow (it still works for logging into the crm itself, just not with this soap log in) ?

Is there a way of white listing a username?

Here is the xml i am sending to get the security tokens:

            
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
                xmlns:a="http://www.w3.org/2005/08/addressing"
                xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><s:Header><a:Action s:mustUnderstand="1">
                    http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action><a:MessageID>
                    urn:uuid:88dea52e-97a3-4222-82cd-3c4cde5e3e2f</a:MessageID><a:ReplyTo><a:Address>
                      http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">
                    uIDPozBEz+P/wJdOhoN2XNauvYcAAAAAK0Y6fOjvMEqbgs9ivCmFPaZlxcAnCJ1GiX+Rpi09nSYACQAA</VsDebuggerCausalityData><a:To s:mustUnderstand="1">
                    https://login.live.com/extSTS.srf</a:To><o:Security s:mustUnderstand="1"
                    xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><u:Timestamp u:Id="_0"><u:Created>2013-04-19T12:41:25.256Z</u:Created><u:Expires>2013-04-19T12:46:25.256Z</u:Expires></u:Timestamp><o:UsernameToken u:Id="user"><o:Username>==USERNAME REMOVED FOR POST==</o:Username><o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
                        ==PASSWORD REMOVED FOR POST==</o:Password></o:UsernameToken><wsse:BinarySecurityToken ValueType="urn:liveid:device"
                      xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><EncryptedData Id="BinaryDAToken0"
                        Type="http://www.w3.org/2001/04/xmlenc#Element"
                        xmlns="http://www.w3.org/2001/04/xmlenc#"><EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"></EncryptionMethod><ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:KeyName>http://Passport.NET/STS</ds:KeyName></ds:KeyInfo><CipherData><CipherValue>
                                ==LONG CYPHER VALUE REMOVED FOR POST==</CipherValue></CipherData></EncryptedData></wsse:BinarySecurityToken></o:Security></s:Header><s:Body><t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust"><wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"><a:EndpointReference><a:Address>urn:crmemea:dynamics.com</a:Address></a:EndpointReference></wsp:AppliesTo><wsp:PolicyReference URI="MBI_FED_SSL"
                      xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" /><t:RequestType>
                      http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType></t:RequestSecurityToken></s:Body></s:Envelope>


This is the response i get:

<?xml version="1.0" encoding="utf-8" ?><S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:psf="http://schemas.microsoft.com/Passport/SoapServices/SOAPFault"><S:Body><S:Fault><S:Code><S:Value>
S:Sender</S:Value><S:Subcode><S:Value>
wst:FailedAuthentication</S:Value></S:Subcode></S:Code><S:Reason><S:Text xml:lang="en-US">
Authentication Failure</S:Text></S:Reason><S:Detail><psf:error><psf:value>
0x80048823</psf:value><psf:internalerror><psf:code>
0x80041010</psf:code><psf:text>
The credential is blocked.&#x000D;&#x000A;</psf:text></psf:internalerror></psf:error></S:Detail></S:Fault></S:Body></S:Envelope>




Add a button to CRM 2011 Form

$
0
0

I'm trying to add a Java Script button the a form in CRM 2011 and it will not work. ?I keep getting this

"Invalid web resource type form form"       any thoughts?  I added it as a resource to my liberary.

 

Thanks,

Jim m.

How do I use JavaScript to query the CRM database in 2011?

$
0
0

Hi,

I'm using CRM 2011 on Rollup 10.

I'm looking to automatically populate the Opportunity form both onload (of the form) and onchange of a particular field.

So, I have a field, let's call it FieldA, which is a text field.  When I enter data into this field I want to automatically populate a number of other fields if there is a match already in the database with the data that has been entered into this field.  The information populated should match a pre-existing opportunity which has the same information as that contained in FieldA.

The fields I want to populate include customerid, and a number of other lookups and dropdowns (let's call these, FieldB, FieldC, FieldD, and FieldE).

What is the best/easiest way to achieve this?

Any help would be greatly appreciated.

Thanks,

Matt.

how to add a horizontal line in ms crm 2011

$
0
0

Hi all,

is there an easy way to add a horizontal rule into a section of an entity in  ms crm 2011?

example:

Total sales order: € 100.000

Change requests:€ 12.000

_______________________ <= this line I want to insert on a form in ms crm 2011 is there a way?(pref. with js)

TSO+CR             : € 112.000

Kind regards

Koen

Hide Option set value

$
0
0
How to hide the one of the value from option set using JavaScript?

If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Yogesh Vijay Mulay

CRM 2011: Xrm.Page.data.entity.attributes.get returning null whilst record has a value

$
0
0

Hi, 

I have added a new field 'iscollege' to Dynamics CRM 2011 Entity. On form load I am checking the value of 'iscollage' as following:  

function form_onLoad(context) {     alert(Xrm.Page.data.entity.attributes.get("iscollage"));
}

Its returning null, whilst record has a value, in advance search the value of 'iscollage' is 'Yes' 

Can anyone please help me to figure out the reason.

Thanks




Concatanate an Option Set - CRM 2011

$
0
0

Dear all

Im fairly new to this Java Scripting lark, and trying to learn as I go along.  That all said, I have an idea but Im not sure how to do it.

I have two option Sets:

The first is months: January, February,....., December  (the option set is called MonthField)

The second is years: 2009, 2010, 2011......  (the option set is called YearField)

What I want to do is to have an on change event on these two option sets, that then populates a date field (DateField) with the 1st of whatever the Month and Year is.

So this was my attempt at the code

function ConcatDate()
{
    var Month = Xrm.Page.getControl("MonthField").getAttribute();
    var Year = Xrm.Page.getControl("YearField").getAttribute();

    Var NewDateVal = "1/+Month+/+Year";

//and then I cant work out how to set the date field to NewDateVal

    }

Any help will be gratefully recieved.

ta

Lee

Ajax Rest and Soap calls conception problems

$
0
0

Hi everybody,

I met a problem, maybe a misunderstood, about ajax rest and soap on CRM 2011.
Explaination :

I try to develop a little web page with a javascript function call on ribbon button click, this function is not very complexe, here the algorithm :

begin
	get CurrentCampaignRecordGuid
	RetrieveMultiple(linked listSet) // Ajax call synchronous. In my case linked list are dynamic
	foreach
		RetrieveMultiple(Fetch) // SOAP call synchronous 
		Count ListMember
	end foreach
	display countTotalMember
end


So my probleme is simple, thats work perfectly with synchronous call but the query can be long and because its synchronous my page is freezed.
So as AJAX stand for Asynchronous, I tried to pass this process on asynchronous mode and to display a loading bar to the user :
- On asynchronous my function finish before the end of all the asyncprocess, so the loading bar is immediately finished
- On asynchronous, I know its possible, but I dont know if its recommanded to call SOAP asynchronously

I need your help to unblock me on those points, what can you suggest me about this kind of process ? Synchronous Asynchronous ?

Thx a lot for your time

Kya

Weird problem, can't set currency field using json2 even with correct syntax

$
0
0

Weird Problem. I've used json2 and REST endpoints to lookup values, but setting a currency item gives me the following error:

Everything else that I set seems to work, it's just the currency field that I can't set. I tried debugging, and I noticed this:

I know that to set currency values "setValue(parseFloat(eval" needs to be used, which is what I've used. But still no luck. I've highlighted the problematic field below in bold, the non-bold items work. Anyone know why it isn't working?

Code:

            //Set Global Variable for results
            var result_timesheet= data.d;
           
            //Set individual Variable for each attribute
            var new_blankVar = result_timesheet.new_blank;
            var new_RateVar = result_timesheet.new_Rate;
            var new_LimitVar = result_timesheet.new_LimitDuration;
            
            //replace the fields with the fields on your entity
            Xrm.Page.getAttribute("new_limitcallcharge").setValue(new_LimitVar);
            Xrm.Page.getAttribute("new_blank").setValue(new_blankVar);
            Xrm.Page.getAttribute("new_ratecalculator").setValue(parseFloat(eval(new_RateVar)));


Can ManagedTokenOrganizationServiceProxy be used without ADFS/STS

$
0
0

I am working on building custom applications that interface with MSCRM using the OrganizationService using on-premise AD auth. In the future we might switch to using ADFS with STS on premise and I would like to ensure that I do not need to change the upstream code significantly to handle this. The CRM best practices guide mentions that the SDK has a ManagedTokenOrganizationServiceProxyclass that derives from OrganizationServiceProxy which handles token management/refresh. Can this be used in lieu of the OrganizationServiceProxy class even if there is no ADFS/STS? Will the behavior downgrade to that of the OrganizationServiceProxy in absence of an STS and when the ADFS/STS is implemented would the behavior upgrade to token based authentication?

I have a facade in place so that the upstream code does not consume these concrete classes directly and uses IOrganizationService instead. I would like to understand the behavioral differences between the two, especially how the Auto Refresh token functionality works with and without an ADFS/STS behind the scenes and can I simply use the ManagedTokenOrganizationServiceProxy currently without ADFS/STS in place without any gotchas?

UPDATE: The SDK has a ServerConnection class which has an GetOrganizationProxy method which in fact uses ManagedTokenOrganizationServiceProxy if the EndPointType is set to *ActiveDirectory*.
I ended up deriving from this class and overriding the GetServerConfiguration like so since the default implementation is Console based and prompts the user for credentials, and I am looking to host this in a library:

      
public class DerivedServerConnection : ServerConnection
    {
        private Configuration config = new Configuration();

        public override Configuration GetServerConfiguration()
        {
            string serverAddress = "<server>.<domain>.com:<port>"; //read from config file   
            string orgURL = @"https:<someURL>/OrganizationService.svc"; //read from config
            Uri organizationUri = new Uri(orgURL);
            Uri discoveryUri = null;
           if(orgURL.StartsWith("https",StringComparison.OrdinalIgnoreCase))
           {
               discoveryUri = new Uri(String.Format("https://{0}/XRMServices/2011/Discovery.svc", serverAddress));
           }
           else
           {
               discoveryUri = new Uri(String.Format("http://{0}/XRMServices/2011/Discovery.svc", serverAddress));
           }
           AuthenticationCredentials a = new AuthenticationCredentials();
            a.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
            Configuration config = new Configuration
            {
                 ServerAddress  = serverAddress,
                 OrganizationUri = organizationUri,
                 DiscoveryUri = discoveryUri,
                 Credentials = a.ClientCredentials,
                 EndpointType = AuthenticationProviderType.ActiveDirectory
            };
            return config;
        }
    }


-Abhijeet



CRM 2011: parent.opener.Xrm.Page.data is null when ever I navigate the user to newly created form

$
0
0

Hi, 

I have two different forms ('Information' and 'College') for an entity and on form load I am navigating to appropriate form based on a condition as bellow:

	if(Xrm.Page.data.entity.attributes.get("new_iscollege") != null && 
	Xrm.Page.data.entity.attributes.get("new_iscollege").getValue() == true && 
	Xrm.Page.ui.formSelector.getCurrentItem().getLabel().toLowerCase() == "information")
	{  
		var items = Xrm.Page.ui.formSelector.items.get();
			for (var i in items) {
				var item = items[i];
				//var itemId = item.getId();
				var itemLabel = item.getLabel()
				if(itemLabel == "College")
				{
					  item.navigate();
				} // end If
			} //end for
	}

On page load it also check for the following:

alert(parent.opener.Xrm.Page.data.entity.getEntityName()); 

Here I am getting the error because of parent.opener.Xrm.Page.data isnull.

 It works fine when record is opened in Information form, but when ever record is opened in 'College' form parent.opener.Xrm.Page.data is null.

Any suggestions please.

Thanks

Where are the UoMSchedule and Product classes? (Dynamics CRM 2011)

$
0
0

Hello there,

I have been following some samples/posts and most of them use a couple of classes that I can not finf. See this post: http://bit.ly/10ntW5q

He uses the following classes: UoMSchedule and Product

UoMSchedule newUnitGroup = new UoMSchedule

Product newProduct1 = new Product

I already have the following using's but no-one contains those classes:

using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Discovery;
using Microsoft.Crm.Sdk.Messages;

Thanks,

Javier Andres Caceres Alvis

Connect to web service with Java

$
0
0

 

Hello,

 

Has anyone tried to consume an MS CRM 4 webservice via Java?  We are trying to connect to the /MSCrmServices/2007/CrmService.asmx page and we receive error 401s.  The IIS log file shows this:

 

2008-09-25 17:51:59 W3SVC1 192.168.250.55 POST /MSCrmServices/2007/CrmService.asmx - 80 mydomain\myusername 192.168.250.1 Java/1.6.0_07 401 5 64

 

I know that if I open the web service page with a browser I get a 302 which is a redirect:

 

2008-09-25 17:55:25 W3SVC1 192.168.250.55 GET /MSCrmServices/2007/CrmService.asmx - 80 mydomain\myusername 192.168.250.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+MS-RTC+LM+8) 302 0 0

 

Has anyone successfully sent user credentials to CRM?

 

TIA.


Trouble with javascript setting Subject

$
0
0

My friendly CRM Helpers. I am trying to fix an issue with javascript and would love to have your assistance. The first group of code works and sets the subject but overwrites the title if it is already entered by the user. I am trying to fix the code to not overwrite the subject if it is already there and only set it if it does not exist. However in my code below there seems to be an error and I can not seem to find where.

Code that works

function SetHealthFairSubject()
{
  var separator = ' - ';
  var regarding = Xrm.Page.data.entity.attributes.get("regardingobjectid").getValue()[0].name;
  var date = Xrm.Page.getAttribute("scheduledstart").getValue().toDateString();;
  var subject = Xrm.Page.getAttribute("subject").getValue();
  	if (subject == null); 
	Xrm.Page.getAttribute("subject").setValue(regarding + separator + "Health Fair Date" + separator + date);
}
Code that does not
function SetHealthFairSubject() {
  var separator = ' - ';
  var regarding = Xrm.Page.data.entity.attributes.get("regardingobjectid").getValue()[0].name;
  var date = Xrm.Page.getAttribute("scheduledstart").getValue().toDateString();;
  var subject = Xrm.Page.getAttribute("subject").getValue();
  	if (subject != null);
		{subject = subject;}
	else {
	if (subject == null);
	{Xrm.Page.getAttribute("subject").setValue(regarding + separator + "Health Fair Date" + separator + date);}
}
}

Quote State (Statecode and statuscode) change through a JavaScript. Uncaught ReferenceError: SDK is not defined

$
0
0

Hi,

I am trying to change state of a Quote from Active to Won using the approach in this link

http://sumedha8.blogspot.com/2011/11/state-statecode-and-statuscode-change.html?showComment=1367270200170#c1865308125016979359

I get the following error message when I call this functionality like 

var QuoteId = Xrm.Page.data.entity.getId();
SetStateRequest("quote",QuoteId, 2, 4);
window.location.reload(true); 

Microsoft Dynamics CRM Error Report Contents<CrmScriptErrorReport><ReportVersion>1.0</ReportVersion><ScriptErrorDetails><Message>Uncaught ReferenceError: SDK is not defined</Message><Line>218</Line><URL>/userdefined/edit.aspx?_gridType=1084&etc=1084&id=%7b9AFA96EF-D7AE-E211-8BD4-78E3B5105EFD%7d&pagemode=iframe&preloadcache=1367271475388&rskey=128101723</URL><PageURL>/userdefined/edit.aspx?_gridType=1084&etc=1084&id=%7b9AFA96EF-D7AE-E211-8BD4-78E3B5105EFD%7d&pagemode=iframe&preloadcache=1367271475388&rskey=128101723</PageURL><Function>anonymous(_entityname,entityid,_state,_status){varrequestMain=""requestMain+="<s:Envelopexmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";requestMain+="<s:Body>";requestMain+="<Executexmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services</Function><CallStack><Function>anonymous(_entityname,entityid,_state,_status){varrequestMain=""requestMain+="<s:Envelopexmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";requestMain+="<s:Body>";requestMain+="<Executexmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\"xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";requestMain+="<requesti:type=\"b:SetStateRequest\"xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\"xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">";requestMain+="<a:Parametersxmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";requestMain+="<a:KeyValuePairOfstringanyType>";requestMain+="<c:key>EntityMoniker</c:key>";requestMain+="<c:valuei:type=\"a:EntityReference\">";requestMain+="<a:Id>"+entityid+"</a:Id>";requestMain+="<a:LogicalName>"+_entityname+"</a:LogicalName>";requestMain+="<a:Namei:nil=\"true\"/>";requestMain+="</c:value>";requestMain+="</a:KeyValuePairOfstringanyType>";requestMain+="<a:KeyValuePairOfstringanyType>";requestMain+="<c:key>State</c:key>";requestMain+="<c:valuei:type=\"a:OptionSetValue\">";requestMain+="<a:Value>"+_state+"</a:Value>";requestMain+="</c:value>";requestMain+="</a:KeyValuePairOfstringanyType>";requestMain+="<a:KeyValuePairOfstringanyType>";requestMain+="<c:key>Status</c:key>";requestMain+="<c:valuei:type=\"a:OptionSetValue\">";requestMain+="<a:Value>"+_status+"</a:Value>";requestMain+="</c:value>";requestMain+="</a:KeyValuePairOfstringanyType>";requestMain+="</a:Parameters>";requestMain+="<a:RequestIdi:nil=\"true\"/>";requestMain+="<a:RequestName>SetState</a:RequestName>";requestMain+="</request>";requestMain+="</Execute>";requestMain+="</s:Body>";requestMain+="</s:Envelope>";varreq=newXMLHttpRequest();req.open("POST",_getServerUrl(),false)//ResponseswillreturnXML.Itisn'tpossibletoreturnJSON.req.setRequestHeader("Accept","application/xml,text/xml,*/*");req.setRequestHeader("Content-Type","text/xml;charset=utf-8");req.setRequestHeader("SOAPAction","http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");varsuccessCallback=null;varerrorCallback=null;req.onreadystatechange=function(){SetStateResponse(req,successCallback,errorCallback);};req.send(requestMain);}</Function><Function>LaunchDialog(QuoteID)</Function><Function>anonymous($p0,$p1,$p2,$p3){Mscrm.CrmHeader.setScriptFile(Mscrm.CrmUri.create($p1),true);for(var$v_0=window,$v_1=$p0.split("."),$v_2=0;$v_2<$v_1.length;$v_2++)if($v_0)$v_0=$v_0[$v_1[$v_2]];if(!IsNull($v_0)&&typeof$v_0===Mscrm.TypeNames.functionType){var$v_3=this.$CN_1($p2,$p3);return$v_0.apply(null,$v_3)}returnnull}</Function><Function>anonymous($p0,$p1,$p2,$p3){var$v_0=this.getCommandDefinition($p0,$p1);if(IsNull($v_0)||IsNull($v_0.Actions))returnfalse;for(var$v_1=0;$v_1<$v_0.Actions.length;$v_1++){var$v_2=$v_0.Actions[$v_1];switch($v_2.ActionType){case2:this.$DF_1($v_2.Attributes);break;case3:var$v_3=$v_2.Attributes;this.$9w_1($v_3.FunctionName,$v_3.Library,$v_2.Parameters,$p2);break;case1:this.$DG_1($v_2.Attributes,$v_2.Parameters);break}}returntrue}</Function><Function>anonymous($p0,$p1,$p2){var$v_0=this.parseCommandFromRibbon($p0),$v_1=this.$7s_1($v_0.command,$v_0.entityLogicalName,$p1,$p2),$v_2=$p1;if(!IsNull($v_2)&&!isNullOrEmptyString($v_2.PopulationXML)&&!$v_2.SuppressCommandIncludes){var$v_3=null;if($v_0.entityContext==="Form"){var$v_4=$find("crmFormSelector");if($v_4)$v_3=$v_4.get_currentFormId()}$v_2.PopulationXML=this.$Ep_1($v_2.PopulationXML,$v_0.entityLogicalName,$v_3)}return$v_1}</Function><Function>anonymous($p0,$p1,$p2){if(this.$1w_1&&!this.$1w_1.$3k_1)returnthis.$1w_1.handleCommand($p0,$p1,$p2);returnfalse}</Function><Function>anonymous(handler,commandId,properties,sequenceNumber){returnhandler.handleCommand(commandId,properties,sequenceNumber)}</Function><Function>anonymous($p0,$p1,$p2){var$v_0=this.$2R_0[$p0];if(CUI.ScriptUtility.isNullOrUndefined($v_0))returnfalse;elseif(Array.isInstanceOfType($v_0)){for(var$v_1=$v_0,$v_2=false,$v_3=0;$v_3<$v_1.length;$v_3++){var$v_4=$v_1[$v_3];if(this.callCommandHandler($v_4,$p0,$p1,$p2))$v_2=true}return$v_2}elsereturnthis.callCommandHandler($v_0,$p0,$p1,$p2)}</Function><Function>anonymous(commandId,properties){returnthis.$DE_0(commandId,properties,this.getNextSequenceNumber())}</Function><Function>anonymous(commandId,properties,commandInfo,root){returnthis.$10_1.executeCommand(commandId,properties)}</Function><Function>anonymous($p0){if(CUI.ScriptUtility.isNullOrUndefined($p0.$4_1))return;$p0.$7Q_1=this.$DU_1();var$v_0=$p0.get_commandInfo();$v_0.CommandId=$p0.$4_1;$v_0.RootId=this.$4_0;$v_0.RootType=this.get_rootType();!CUI.ScriptUtility.isNullOrUndefined(this.$26_1)&&this.$26_1.executeRootCommand($p0.$4_1,$p0.$32_1,$v_0,this)}</Function><Function>anonymous($p0){this.$7s_1($p0);returntrue}</Function><Function>anonymous($p0){if($p0.$I_1!==11){$p0.get_commandInfo().RootLocation=$p0.$I_1===2?"UpperRibbon":"LowerRibbon";if($p0.$I_1===2){var$v_0=$p0.$32_1;$p0.get_commandInfo().TabId=$v_0.NewContextId}}returnCUI.Root.prototype.$2n_0.call(this,$p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function></CallStack></ScriptErrorDetails><ClientInformation><BrowserUserAgent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31</BrowserUserAgent><BrowserLanguage>undefined</BrowserLanguage><SystemLanguage>undefined</SystemLanguage><UserLanguage>undefined</UserLanguage><ScreenResolution>1920x1080</ScreenResolution><ClientName>Web</ClientName><ClientTime>2013-04-29T14:38:00</ClientTime></ClientInformation><ServerInformation><OrgLanguage>1033</OrgLanguage><OrgCulture>1033</OrgCulture><UserLanguage>1033</UserLanguage><UserCulture>1033</UserCulture><OrgID>{06156408-5436-4116-B9C4-97CD63712DAA}</OrgID><UserID>{EA51D295-C04E-491A-B400-DB9E3D58BB18}</UserID><CRMVersion>5.0.9690.3358</CRMVersion></ServerInformation></CrmScriptErrorReport>


fetchXml multiple entities in CRM 4

$
0
0

hi All,

I have issue with fetchXml Query, I need display results from two link-entities, but I need condition "OR" between entities, because below query display only records which are in both entities,
I want records from "new_project_vendors" and "new_project_contacts".

var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
                   "<entity name='contact'>" +

                   "<attribute name='firstname' />" +
                  "<attribute name='lastname' />" +
 "<attribute name='contactid' />" +
 "<order attribute='lastname' descending='false' />" +

 "<link-entity name='new_project_vendors' from='contactid' to='contactid' visible='false' intersect='true'>" +
 "<link-entity name='new_project' from='new_projectid' to='new_projectid' alias='aa'>" +
 "</link-entity>" +
 "</link-entity>" +


"<link-entity name='new_project_contacts' from='contactid' to='contactid' visible='false' intersect='true'>" +
"<link-entity name='new_project' from='new_projectid' to='new_projectid' alias='ab'>" +
"</link-entity>" +
"</link-entity>" +

"</entity>" +
                   "</fetch>";



Thankful for any help I get.

             

style an asp.net webform like mscrm 2011

$
0
0

Hi,

I have created an Iframe which contains an Asp.net web form (hosted in its own separate site).

The web form has a data grid which shows a list of documents. Each row has the document name and a button to select it. 

I would like to make this grid look like an Mscrm 2011 list:

so: 

1. same font

2. same colour

3. a header row that is the same etc

Maybe an icon as well.

(see below) 

Currently my asp code is:

<div id="gridDiv"><asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CssClass="table table-striped table-bordered table-condensed"><Columns><asp:BoundField DataField="id" HeaderText="id" SortExpression="id" Visible="True" /><asp:BoundField DataField="DocName" HeaderText="name" SortExpression="name" /><asp:TemplateField><ItemTemplate><div id="buttonDiv"><input type="button" id="SubmitButton" value='Select document' /></div></ItemTemplate></asp:TemplateField></Columns></asp:GridView></div>

How can I do this? Is there a style sheet - that will style the rows and the headers? 

Thanks for your help.


How to implement IOrganizationService

$
0
0
Are there any proper guidelines / examples that illustrate implementing the IOrganizationService interface?  I am looking for a mock implementation for testability of business logic. In particular, how would 'RetrieveMultiple(QueryBase)'  be implemented for passing in QueryExpressions?

-Abhijeet

Viewing all 1000 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>