How to update only the StatusCode of an entity in MS CRM Dynamics 2013 - dynamics-crm-2013

I'm trying to update a Quote status code in MS CRM 2013 via the SDK. The issue is that I only need to update the status code and not the state code in the quote. The current State of the quote is Active and the current Status value is 10 (which I need to update to 11). I've tried a few things unsuccessfully so far:
Using the Microsoft.Crm.Sdk.Messages.SetStateRequest(), setting only the Status property:
var request = new SetStateRequest
{
EntityMoniker = new EntityReference("quote", quoteId),
Status = new OptionSetValue(11)
};
var resp = (SetStateResponse) orgService.Execute(request);
// throws Exception Microsoft.Xrm.Sdk.OrganizationServiceFault:
// "Required field 'State' is missing"
Using the Microsoft.Crm.Sdk.Messages.SetStateRequest(), setting both Status and the State property (setting the new State to the same current value):
var request = new SetStateRequest
{
EntityMoniker = new EntityReference("quote", quoteId),
State = new OptionSetValue((int) QuoteState.Active),
Status = new OptionSetValue(11)
};
var resp = (SetStateResponse) orgService.Execute(request);
// throws Exception Microsoft.Xrm.Sdk.OrganizationServiceFault:
// "The quote cannot be activated because it is not in draft state."
Calling the Update method (passing in a quote instance) in the Microsoft.Xrm.Sdk.Client.OrganizationServiceContext class. I don't have the exact code I used when I tried this, but the error I was getting was:
"The object cannot be updated because it is read-only."
I made sure the connection was made using admin user credentials, but it didn't make a difference. I also found a few other posts like this one: read-only entity error but that didn't help either.
Question
Is there a way to programmatically update the Quote status code without altering the state code? If so, how?

The Status Reason (statuscode field) of a entity depends on the Status (statecode field) value.
For example the standard values for a Quote are the following
so inside your SetStateRequest you need to set the a valid combination (for example you can't set a quote to be Active and Revised) specifying both the values.
In your question you wrote that you are using custom Status Reason, you need to check under which Status you added them and try again.

Seems like my issue has to do with the current state of the quote - Active. Apparently, Active quotes cannot be updated for the most part - I wasn't able to update its status reason even through the GUI. I found this post with a similar scenario.
As the post suggests, I was able to programmatically update my quote status by first sending it back to Draft/In Progress, and then updating its state/status to Active/11.

Related

How to retrieve omniture using omniture developer api

We have programmed in android to track omniture using page name using the code
Analytics.trackState(pageName, params);
The params contains lot if data like s.channel, s.prop, Prop, s.eVar
Now: We want get all the params which got recorded in omniture by hitting this link
I am trying to use the nomniture module to call Report, but it is very difficult to understand the parameters to choose a particular page
My Node.js Code
var Client = require('omniture').Client, c = new Client(username,
sharedSecret, 'sanJose'), reportData = {
"rsid_list" : [ reportSuiteId ]
}
How to use s.pageName in a request to retrieve the recorded variables for a particular custom page name
I tried to use Report.QueueTrended, Report.QueueOvertime, Report.QueueRanked followed by Report.Get but I am not getting anything
I always ended up getting errorCode 5003, The report may contain imcomplete data. Please try again later

How to update status in Attask Workfront through API calls

I have been trying to use
PUT .../api/v4.0/task?updates=[{"ID":"XYX","status":"InProgress"}
Do we need to add any other headers other than Content-Type?
I am getting error.
This solved it.
PUT .../api/v4.0/task/{ID}?fields=parameterValues&updates={"status": "INP"}
That would change the status from New to INProgress. The main thing was abbreviation for InProgress is INP and also adding fields.
You are correct, you must use the key for the status. You can get these from the API metadate with the status enum or you can get them from the interface from Setup -> Project Prefs -> Statuses.
They are case sensitive.

MVC4 Force session update before request ends

We are developing using VS2010 and MVC4, deploying our web app on an IIS 7.5 on Windows7.
Our project has a long running process for which we want to display status and progress.
In order to accomplish this we have a small serializable class with properties that describe the current status. The long operation pseudo code goes like this:
int curentPercentComplete = 0;
EngineStatus status = new EngineStatus();
while (!done) {
status.PercentComplete = curentPercentComplete;
Session['status'] = status;
// do lengthy operation
curentPercentComplete = compute();
done = isJobFinished();
}
We also have an other controller action that tries to retrieve the current status from the session
which then encodes to json and returns it to the browser via an Ajax request.
Our problem is that we always seem to get the last saved data from the previous request, in other words the session object does not seem to update the Session['status'] field during the execution of the while block.
We have tried the session state mode both InProc and StateServer with exactly the same behavior.
Thanks in advance.
It turns out that the MVC framework performs a single update of the session data at the end of the request which means that only the last value is saved.
Since the "lengthy" operation is performed in a single request-response cycle, the idea of storing intermediate status information in the session is plain wrong.

I am trying to use Yodlee/executeUserSearchRequest as a RESTful request and need an answer on how to call

I am working with the Yodlee services in c# and using the RESTful api. So far I have successfully connected and logged in with my CobrandSession and UserSessionToken in the development environment. I used the sample apps provided in c# and with some advice from shreyans i got an app working. What I got working was
1) Get YodleeAuthentication
2) Get UserAuthentication
3) Get ItemSummaries
I am now trying to get the full transaction details for each of the Items (i.e. collections of accounts that are an Item)
reading the Docs here https://developer.yodlee.com/Indy_FinApp/Aggregation_Services_Guide/REST_API_Reference/executeUserSearchRequest it states that I need to call executeUserSearchRequest and then paginate through the results using the getUserTransactions. So I am stuck at this point. I dont really want a search which has parameters I just want ALL transactions for this account that I can see.
However, I am using the variables as defined in that page :-
var request = new RestRequest("/jsonsdk/TransactionSearchService/executeUserSearchRequest", Method.POST);
request.AddParameter("cobSessionToken", param.CobSessionToken);
request.AddParameter("userSessionToken", param.UserSessionToken);
request.AddParameter("transactionSearchRequest.containerType", param.ContainerType);
request.AddParameter("transactionSearchRequest.higherFetchLimit", param.HigherFetchLimit);
request.AddParameter("transactionSearchRequest.lowerFetchLimit", param.LowerFetchLimit);
request.AddParameter("transactionSearchRequest.resultRange.endNumber", param.EndNumber);
request.AddParameter("transactionSearchRequest.resultRange.startNumber", param.StartNumber);
request.AddParameter("transactionSearchRequest.searchFilter.currencyCode", param.CurrencyCode);
request.AddParameter("transactionSearchRequest.searchFilter.postDateRange.fromDate", param.FromDate);
request.AddParameter("transactionSearchRequest.searchFilter.postDateRange.toDate", param.ToDate);
request.AddParameter("transactionSearchRequest.searchFilter.transactionSplitType.splitType", param.SplitType);
request.AddParameter("transactionSearchRequest.ignoreUserInput", param.IgnoreUserInput);
request.AddParameter("transactionSearchRequest.searchFilter.itemAcctId", param.ItemAcctId);
var response = RestClientUtil.GetBase().Execute(request);
var content = response.Content;
return new YodleeServiceResultDto(content);
As per the response from shreyans in this posting Getting Error "Any one of [**] of transactionSearchFilter cannot be NULL OR Invalid Values I am not putting in the ClientId and the ClientName
The documentation doesn't specify the format of the dates but the example seems to tell me that its american date format. And specifies a parameter saying IgnoreUserinput, but doesnt have a parameter for user input so this is confusing
When I make a call using this format I get an error response
var getSearchResult = yodleeExecuteUserSearchRequest.Go(yodleeExecuteUserSearchRequestDto);
getSearchResult.Result="
{"errorOccured":"true","exceptionType":"Exception Occured","refrenceCode":"_60ecb1d7-a4c4-4914-b3cd-49182518ca5d"}"
But I get no error message in this and I have no idea what I have done wrong or where to look up this error, can somebody who has used Yodlee REST Api point me in the right direction as I need to get this researched quickly....
thanks your your help, advice, corrections and pointers....
Here is the list of parameters which you can try
1) For a specific ItemAccountId all transactions
transactionSearchRequest.containerType=all
transactionSearchRequest.higherFetchLimit=500
transactionSearchRequest.lowerFetchLimit=1
transactionSearchRequest.resultRange.startNumber=1
transactionSearchRequest.resultRange.endNumber=500
transactionSearchRequest.searchClients.clientId=1
transactionSearchRequest.searchClients.clientName=DataSearchService
transactionSearchRequest.searchFilter.currencyCode=USD
transactionSearchRequest.searchClients=DEFAULT_SERVICE_CLIENT
transactionSearchRequest.ignoreUserInput=true
transactionSearchRequest.ignoreManualTransactions=false
transactionSearchRequest.searchFilter.transactionSplitType=ALL_TRANSACTION
transactionSearchRequest.searchFilter.itemAccountId.identifier=10000353
2) For a Specific account (itemAccountId) with start and end dates
transactionSearchRequest.containerType=all
transactionSearchRequest.higherFetchLimit=500
transactionSearchRequest.lowerFetchLimit=1
transactionSearchRequest.resultRange.startNumber=1
transactionSearchRequest.resultRange.endNumber=500
transactionSearchRequest.searchClients.clientId=1
transactionSearchRequest.searchClients.clientName=DataSearchService
transactionSearchRequest.searchFilter.currencyCode=USD
transactionSearchRequest.searchClients=DEFAULT_SERVICE_CLIENT
transactionSearchRequest.ignoreUserInput=true
transactionSearchRequest.ignoreManualTransactions=false
transactionSearchRequest.searchFilter.transactionSplitType=ALL_TRANSACTION
transactionSearchRequest.searchFilter.itemAccountId.identifier=10000353
transactionSearchRequest.searchFilter.postDateRange.fromDate=08-01-2013
transactionSearchRequest.searchFilter.postDateRange.toDate=10-31-2013

400 Bad Request error when using .net Paymill Wrapper

I'm trying to use the .net Paymill Wrapper
When trying to add a subscription, I'm getting back a 400 Bad Request.
To illustrate the problem, I created a branch and changed the Sandbox console app to call the method to test addSubscription
The problem is happening here where the request is actually posted.
The content posted is: (as an example)
client=client_bbe895116de80b6141fd&
offer=offer_32008ddd39954e71ed48&
payment=pay_81ec02206e9b9c587513
It appears this hasn't been updated for sometime, and the original author is unresponsive via email or twitter, so I've forked the repo and am trying to fix the error.
I had a look at your code and found out that you are not creating the offer object correctly.
In your addSubscription method (SandboxConsole project), i found this code snippet
Subscription subscription = new Subscription();
subscription.Client = new Client() { Id = "client_bbe895116de80b6141fd" };
subscription.Offer = new Offer() { Id = "offer_32008ddd39954e71ed48" };
subscription.Payment = new Payment() { Id = "pay_81ec02206e9b9c587513" };
Offer object should be initialized with parameters like amount, currency, interval.
Since the offer object doesn't exist, assigning a subscription to it fails, giving you bad request error.