Alan Judi

1

votes
1

answer
771

views

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary: DYNAMICS 365 Plugin

When I run a Unit Test for my plugin I get the following Exception being Thrown: Message: Test method Plugins.Tests.UnitTest1.TestUnitPlugin threw exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. The following link will give you the stack...
Alan Judi
1

votes
1

answer
199

views

How To Write A Plugin that triggers when a related Sub-grid is updated

I am creating a plugin that is supposed to trigger when a new record is added in a sub-grid (contractdetail) on form for the contract entity. There is a 1-N relationship between contract and contractdetail (contract_line_items). I only want my plugin to execute if the contract entity is active (stat...
Alan Judi
1

votes
1

answer
70

views

How to get back form data from Web resource after using Xrm.Navigation.openWebResource()

I have a Web resource that is opened on the click of a button as follows: var windowOptions = { height: 400, width: 50 }; Xrm.Navigation.openWebResource('DCWIMS_/html/datepicker.html', windowOptions); I have a little input field inside the html webresource (as you can guess, it’s a date time field...
Alan Judi
1

votes
1

answer
0

views

Display button on Entity HomePageGrid in RibbonWorkBench

I want to display a button on the Home Page of a custom entity called new_orders. I only want that button to show on the home page and not the form of the individual records of the custom entity. I only want it to show for that custom entity. Is EntityRule the right approach through ribbonworkbench?...
Alan Judi
1

votes
1

answer
0

views

Left Join fetchXml based on common column

I have two tables that are not related, but have a common column. I want to join the rows in table B that match with in Table A. Table A looks like this: Table B looks like this:
Alan Judi
1

votes
1

answer
0

views

Will this fail if the returned number of records is below 5000?

I have a multirequest for a QueryExpression that I wrote. In some cases, more than five thousand records are returned, while in others less than 5000 records are returned. I am worried that this would fail if the count is less than 5000. Is this true?! QueryExpression queryService = conversionRespon...
Alan Judi
1

votes
1

answer
160

views

How can you update a field that is locked by system via Plugin?

I have a field in my contract line entity that is locked by the system as shown here: I want to update this field using a plugin via the following code: //Update Contract Line StartDate Entity updatedContractLine = new Entity('contractdetail') { Id = entity.Id }; updatedContractLine['activeon'] = st...
Alan Judi
1

votes
2

answer
79

views

BAD REQUEST When making an AJAX CALL: This.readyState is undefined

I wrote a function that fetches the guid of a lookup field and uses that to make an AJAX call. This is the the call that I made: fetchOptionSet: function (executionContext) { var formContext = executionContext.getFormContext(); //get form context var client = Xrm.Page.context.getClientUrl(); //ge...
Alan Judi
1

votes
1

answer
0

views

Return unique values from _.map()

I have grouped a collection of data using underscore's groupBy, however when I map the data that was grouped, I am getting duplicates: var data = []; for (var i = 1; i < (allTextLines.length - 1); i++){ var obj = {}; var allTextLine = allTextLines[i].split(','); obj['date'] = allTextLine[headerC...
Alan Judi
0

votes
0

answer
5

views

DISTINCT based on multiple columns

I have a groupby in linq that looks like this: var grouped = from all in Allergies.Entities.AsEnumerable() group (Guid)all.GetAttributeValue('allergy.new_foodsensitivityid').Value by new { group = all.GetAttributeValue('new_group'), time = all.GetAttributeValue('new_time'), desc = all.GetAttributeVa...
Alan Judi
0

votes
0

answer
14

views

Left outer join in linq to entites on two entitycollections:

I have two entitycollections that have 3 common attributes. The first entitycollection is called Replacements with attributes of new_time, new_serving, new_desc and other attributes. I have a second entitycollection called NoReplacements which has a bunch of attributes including new_time, new_servin...
Alan Judi
2

votes
1

answer
49

views

System.InvalidCastException (“Specified cast is not valid.”) in a FetchXML query for an OptionSet Attribute

I am trying to retrieve the numeric value of each OptionSet returned by a FetchXML Query. The value retrieved is aliased and I want to cast the aliased value into an integer and store each value into a list. The system gives me an InvalidCastException each time, what should I do to fix this ??? Here...
Alan Judi
1

votes
2

answer
72

views

Why won't records delete?

I wrote a plugin that gets the GUID IDs through fetchXML and uses Batch delete to delete the records in batches of 1000. I debugged the plugin and it shows that the plugin executes all the way through to service.RetrieveMultiple(new FetchExpression(fetchxml)), however, the fetched records are not g...
Alan Judi
1

votes
2

answer
230

views

System.NullReferenceException: Object not set to an instance of an object?

I am writing a plugin that deletes records between two dates when a contract is cancelled... The records to be deleted are from the cancellation date to the end of the contract. Here is the code I am using: using System; using System.Linq; using System.ServiceModel; using Microsoft.Xrm.Sdk; using M...
Alan Judi
3

votes
1

answer
54

views

Plugin Execution Halts After exactly 33 records created, What is the cause?

I have a plugin that creates records in an entity called 'Alter Unit Order'. It is supposed to create records for each day from contract start date to contract end date. No matter what, the plugin will only create 33 records. I'm thinking its probably because of how many FetchXML queries are being m...
Alan Judi
2

votes
1

answer
263

views

FetchXML vs Query Expression vs LINQ Query: What should I use here?

I need help from those kind enough to provide help! I am running an instance of Dynamics 365 and I need help deciding whether to use FetchXML, LINQ Query or Query expression to query an entity I have called contract lines.... Let me explain the project: Inside the contracts entity, I have contract...
Alan Judi
1

votes
2

answer
61

views

Server Returns Bad Request 400 On REST POST CALL, even though uri is correct

I am trying to add an option label and option value to an optionset field(new_contractserving) found on an entity called new_servingtime. Not sure if I am doing this correctly, but the server throws a 400 Bad request, what's the issue?! var entity = { 'new_contractserving': String(OptionValue), 'n...
Alan Judi