I'm executing my query and it works fine when I'm using the following ColumnSet.
...
ColumnSet = new ColumnSet(
"name",
"address1_postalcode",
"beep_cin",
"telephone1",
//"address1_street1",
"address1_city"),
...
However, when I uncomment the street reference, I get an error telling me that such an attribute doesn't exist. I'm guessing it's got to do with the control being composite.
How can I access in CRM 2013 the equivalent of address1_street1 in CRM 2011?
Why can I access the other address_... fields like I'm used to but not street1?
Edit
I discovered also that even on the client, using JavaScript, there seems to be something weird. Let's try to run the following two lines (frames[0] is there because that's how it works in IE console window, F12).
frames[0].Xrm.Page.getAttribute("address1_street1").getValue()
frames[0].Xrm.Page.getAttribute("address1_city").getValue()
While the first one gives me Stockholm, the seconds yields an error because the returned attribute is null, despite the fact that I've entered the street as supposed to. Furthermore, I notice that the following line:
frames[0].Xrm.Page.getAttribute("address1_composite").getValue()
returns the whole composite address text - street, city, country etc. In that attribute, there's an object called controls but I didn't find anything useful in it. This is weird and unexpected. I don't like the combination of weirdness and unexpectedness.
Please note that it's the CRM13 version that the weirdification occurs in.
Of course, I could use this atrocity below but is that really what we want to see on the screen of every CRM developer?! It makes my eyes bleed and my will to live withers.
Xrm.Page.getControl("address1_composite_compositionLinkControl_address1_line1")
Besides, I still don't get the value and I still can't see how to use it in C#!
I don't know which entity you want to retrieve, but normally the logical name for Address 1: Street1 field is address1_line1
Here the Attribute Metadata for Account entity:
http://msdn.microsoft.com/en-us/library/gg328057(v=crm.5).aspx#bkmk_attributes
Related
When calling WorkFront's API
https://preview.workfront.com/attask/api/v7.0/HOUR/search?fields=*,parameterValues
I get a 500 error. It works fine if I don't specify parameterValues. In comparison providing a bogus field returns:
https://preview.workfront.com/attask/api/v7.0/HOUR/search?&fields=*,garbageParam
{"error":{"class":"java.lang.IllegalArgumentException","message":"APIModel V7_0 does not support field garbageParam (Hour)"}}
I can't simply remove parameterValues because the url is generated by the code, and I didn't see a means of determining if a particular ObjCode will or won't crash if given parameterValues.
My code is supposed to dump the JSON into C# classes I have, so I need all the fields that are available. Unfortunately WorkFront crashing by being requested all the fields is throwing a wrench into the design.
Is there a way to get around the 500 error, or a way to detect if paramterValues should be provided or not?
I am not sure why you are getting a 500 Error rather then a more specific error but Hours do not contain custom data so parameterValues would not contain any data on the HOUR object. If you were to make the same Call on the TASK object it would work.
So, as the title say, I am running into this particular error randomly. When I select a particular search criteria, and then use paging events to move to next page, system throws this error.
Funny thing is, not only the search criteria has to specific, but the value doesn't exist. According to .Net, this is the error
A potentially dangerous Request.Form value was detected from the client (objListOfMR^MRHD_MR_Description~7="...ion ASMSD <asmsd#autoshell.com...").
Where MR description is the text field taken from database. So, I checked the database, and the actual value is
Alarm P on PSM unit
No other field has that line <asmsd#autoshell.com anywhere. All records on Page 2 or further of the search result, show this error.
I tried the same thing on the test database (copy of live database), and that worked wonderfully. without any errors.
So, first thing I want to do is, know where is this line coming from. And why is it not coming for test database.
I know how to do a quick hack to fix this, but that's not what I want to try right now.
I've been assigned to work on a project that uses the AtTask API to create an issue and accompanying custom form from a web application I've built for our intranet. I've been using this post, ATTask API - Updating Custom Field with API and C Sharp, as my main starting reference for accomplishing my task.
Like that post, I'm also getting (500) Internal Server Error, though the error I receive the URL is inserted directly into the browser is {"error":{"class":"com.attask.util.json.JSONException","message":"org.codehaus.jackson.JsonParseException: Unexpected character ('S' (code 83)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: java.io.StringReader#45c828e1; line: 1, column: 6]"}}.
My URL looks like this:
https://myCo.attasksandbox.com/attask/api/v3.0/optask?method=put&projectID=myID&name=API%20SandBox%20Issue&updates={DE:Service%20Affected:Electronic%20Communications,DE:Technical%20Details:I%20dunno,DE:How%20will%20this%20change%20be%20communicated?:It%20wont}&username=myUserName&password=myPassword
I have noticed that one difference between the post I reference above and my URL is that the other post's URL is looking for a categoryID. Is that necessary for working with Custom Forms? If so, where do I find that ID? (I did a search query on an issue that had custom form of the kind I'm trying to generate, but no categoryID was returned).
By the way, my search query looks like this:
Console.WriteLine("**Searching for Change Management Issues");
JToken cmIssues = client.Search(ObjCode.ISSUE, new
{
projectID=cmProjID,
name="SandBox Issue",
name_Mod="contains",
fields="parameterValues"
});
foreach (JToken issue in cmIssues["data"].Children())
{
Console.WriteLine(issue["name"]);
Console.WriteLine(issue["categoryID"]);
Console.WriteLine(issue);
}
I've used both ISSUE & OPTASK ObjCode types, with no luck on the categoryID.
Try removing the sessionID. At the end you are using your username & password, you do not need both. Make sure you spell password correctly. In your example you spelled it wrong.
If that does not work. Make sure all the spaces are replaced with %20 by UrlEncode it before you send the call.
After finally being able to come back to this project, I found that my problems lay with my unfamiliarity with JSON calls. For this particular issue, (after the I fixed the spelling of password), I was receiving my error because I had surrounded neither the custom form object I was sending nor the related value in quotation marks.
Basically, my problem was that I was doing this:
DE:The Object:The Value
when I should have been doing this:
"DE:The Object":"The Value"
So I am just trying to get RavenDB up and running and I have struggled with several issues but finally got it working. I was able to successfully insert and pull records for display.
However, I decided to move the class I was using to generate documents from to another spot which cause a namespace change. I ran ran everything and I can still insert documents to Raven. But when I try to pull them for display purposes I get the following error:
Unable to cast object of type 'Library.Logging.RewardProviderLog' to type 'Admin.ViewModels.ImportMonitorViewModel'.
So after going through all of the other posts I could find online it seems that the issue has something to do with the Raven-Clr-Type that essentially tracks the namespace information of the object you are saving as a document.
Ok. So I went in and deleted all the documents I created since I am still just testing and trying to get things running. I even went ahead and blew away the index and recreated it. I ran my process of inserting a new log. But I still get the same error message when I try to pull them and display them.
Note: ViewModels.ImportMonitorViewModel and Library.Logging.RewardProviderLog are identical. They contain the exact same properties.
Update
Index (named ImportMonitorLogs):
from doc in docs.RewardProviderLogs
select new {doc.status, doc.newItemsCount, doc.additionalInfo, doc.lastRun};
Query:
DocumentStore RavenDBStore = new Raven.Client.Document.DocumentStore { Url = "myurl" };
RavenDBStore.DefaultDatabase = "yei-logs";
RavenDBStore.Initialize();Raven.Client.Indexes.IndexCreation.CreateIndexes(System.Reflection.Assembly.GetCallingAssembly(), RavenDBStore);
using(var session = RavenDBStore.OpenSession())
{
model = (from log in session.Query<ViewModels.ImportMonitorViewModel>("ImportMonitorLogs")
orderby log.lastRun descending
select log).ToList();
}
Putting aside the rename and what might have worked before, the error matches the query you are attempting. You are indexing documents of type RewardProviderLog, and retrieving them directly as type ImportMonitorViewModel.
You say all of the properties are the same in both classes, but that alone won't get RavenDB to duck-type them for you. You have to be a little more explicit. This will probably work:
model = (from log in session.Query<RewardProviderLog>("ImportMonitorLogs")
orderby log.lastRun descending
select log).As<ViewModels.ImportMonitorViewModel>().ToList();
Or if you want slightly cleaner syntax (IMHO), this is equivalent:
model = session.Query<RewardProviderLog>("ImportMonitorLogs")
.OrderByDescending(x=> x.lastRun)
.As<ViewModels.ImportMonitorViewModel>()
.ToList();
The key here is that you are querying based on the type that matches the entity your index is returning, and that you use the As method to duck-type it into your view model. (This is the same thing as OfType<T>, and you can read more in the docs here).
If you want to get a bit fancier and project different fields or project from the index directly, you can look at AsProjection in the docs here.
If you're still scratching your head as to why this worked before, I can see that it might have worked if your viewmodel an entity were named the same thing - even if they were from different namespaces. They would still have the same Raven-Entity-Name metadata value.
I am just getting started with the QBD v2 .net sdk and am starting out by trying a simple customer query. I have no filters on the query and simply bind the returned list to a grid. My problem is, I am binding OpenBalance.Amount to a column and it is returning 0 instead of the proper amount. Is there something in the query object that I need to set to get the proper open balance, or possibly something that needs to change in the sync process from my file to the Intuit cloud? The code that I am using is simply:
CustomerQuery custQuery = new CustomerQuery();
IEnumerable<Customer> oCustomers = custQuery.ExecuteQuery<Customer>(context);
Like I said, the query is returning the customers I expect to see but the open balances are not correct. Please let me know what I am missing.
The entity is likely in an error state. You can check by executing a query and setting ErroredObjectsOnly=true.
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0100_Calling_Data_Services/0015_Retrieving_Objects#Objects_in_Error_State
If the entity is in error state, you can query for the specific reason using the SyncStatus API:
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0600_Object_Reference/SyncStatus
From there, you will need to delete or revert the object in error state, depending on if a sync has occurred.
Delete (sync has not occurred):
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0100_Calling_Data_Services/Deleting_an_Object
If a successful sync did occur with the entity at least once, but then an Update pushed it into error state, you will need to do a Revert:
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0100_Calling_Data_Services/Reverting_an_Object
You can also try doing an Update (Mod) directly on the entity in error state once you know the reason from the SyncStatus API, but it is not documented so it may not work.
Can you try to call 'Get by ID' api from apiexplorer and check if you are facing the same issue.
Link - http://apiexplorer.developer.intuit.com
You can also refer the following link to get some related code snippets.
https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0200_ipp_java_devkit/0800_crud_examples
Most probably there are some jobs associated with that customer record.
Can you please try to query using the customer filter endpoint with 'OpenBalanceWithJobs' flag set as true.
<CustomerQuery xmlns="http://www.intuit.com/sb/cdm/v2">
<OpenBalanceWithJobs>true</OpenBalanceWithJobs>
</CustomerQuery >
Endpoint - https://internal.services.qdc.intuit.com/sb/customer/v2/
In the response xml, you should get the open balance related to the job.
...
<OpenBalanceWithJobs>
<CurrencyCode>USD</CurrencyCode>
<Amount>12420.98</Amount>
</OpenBalanceWithJobs>
...
You can try the apiexplorer tool to test this use case.
Link - https://developer.intuit.com/apiexplorer?apiname=V2QBD
Please let us know if it resolves this issue.
Thanks