Update Fields Supplier Invoice - s4sdk

I'm looking for an Odata service that can update values of supplier invoices. I know that I can do it using BAPI, but I would like to know if there is a way to do it using a update from OData service or something similar.
The fields that I want to change are:
Block a Payment
Change Assignment Number
Change Payee
Thanks in advance.

As of now it is not possible to change fields of a supplier invoice. Looking at the API Hub you just have the option to create and read supplier invoices as well as releasing/canceling them.
To request a change in the API you can submit a request in the Customer Influence Site.

Related

Microsoft Dynamics Web API | PATCH invoice detail

Does anyone know how to update the invoice detail entity along with Invoice under postman? I have searched google but not find many useful answers for this. I even try to use odata.bind annotation but still not able to solve my issue here. Basically, I just want to update Invoice Details along with Invoice in one API call. Any help will be appreciated.
Thanks in advance.
We have a concept called deep insert for creating parent and child record in one call. Unfortunately for updating/patching we have to deal with one object at a time. ie invoice and invoice detail separately.

How to create a contact record with customer field set as contact or account

I am trying to create a contact record with its customer set to Account/Contact where customer records are pre-existing.
Here is the request that I am trying.
POST <service>/api/data/v8.0/contacts
{
'lastname':’contact1’,
'parentcustomerid_contact': '/contacts(f797401d-64c9-e711-8125-000d3a22f66f)'
}
I also tried providing full url of the contact record, but that is also not working. Appreciate any help with correct query or any document that I shall go through to get this scenario working.
You have to use like this parentcustomerid_contact#odata.bind to bind single valued navigation properties.
you must use the #odata.bind annotation to set the value of a single-valued navigation property.
Read more

Product slug not working in CRM 2013 Email templates

I have a business requirement that execs are really wanting to see. In our lead and email templates we have a few of our products listed. The products themselves are pretty stable but the prices are of course subject to change.
I'm OK with hard coding the product name into email but I was hoping the price could be a slug that get's resolved.
We only have one price list so nothing to worry about there.
I see no way to get access to the product and or price list entities through the data field values dialog.
So my thought was to create the 2-4 fields in the lead and opportunity entities. Then create a background workflow that takes the price from the price list and sets those fields.
Then when an email is generated I can access those hidden fields as they will be available through the lead or opportunity entity.
Any thoughts, concerns, better approaches?
Unfortunately CRM's email template system is not capable of what you describe out of the box. As you have discovered it will only permit you to insert placeholders from, or assocated with, the primary entity. It won't let you insert fields from other entities. What you suggest as a workaround is possible but it's not an ideal solution as you'll have these 2-4 redundant fields on each record type that contain duplicated data from the price list.
If you have any experience with creating custom workflow activities using the SDK then the best solution here is to create a custom activity that accepts either an draft Email or Email template as a input parameter, instantiates the email if required, loads the price list data, and performs your own custom placeholder replacements.
I've done this on a few projects in order to pass multiple entity records into the template, or to insert complex tables into emails by loading data from relationships. See the screenshots below for an example of how I've configured the email template and dialog process to pass both an 'Account' and 'User' record into the email template.

WebAPI - odata service adding ForeignKey

i am building my the model using ODataModelBuilder, i am trying to create navigation property however in the metadata i dont see any foreginkey indication, in my solution i am not using EF, so there is no foreignKey attribute, is it possible to add it by code?
As you clarified in your comment, the reason you want to add foreign key information is because your client application is not including related entities when you query the main entity. I don't think foreign keys are the problem here.
As an example, I'll use two entity types: Customer and Order. Every Customer has some number of associated Orders, so I have a navigation property on Customer called Orders that points to a collection of Orders. If I issue a GET request to /MyService.svc/Customers(1), the server will respond with all of the Customer's information as well as URLs that point to the related Order entities*. I won't, by default, get the data of each related Order within the same payload.
If you want a request to Customers(1) to include all of the data of its associated Orders, you would add the $expand query option to the request URI: /MyService.svc/Customers(1)?$expand=Orders. Using the WCF Data Services client (DataServiceContext), you can do this with .Expand():
DataServiceQuery<Customer> query = context.Customers.Expand("Orders");
However, WebAPI OData doesn't currently support $expand (the latest nightly builds do though, so this will change soon).
The other approach would be to make a separate request to fill in the missing Order data. You can use the LoadProperty() method to do this:
context.LoadProperty(customer, "Orders");
The LoadProperty approach should work with WebAPI as it stands today.
I know this doesn't answer your original question, but I hope addresses your intent.
*In JSON, which is the default format for WebAPI OData services, no links will show up on the wire, but they are still there "in spirit". The client is expected to be able to compute them on its own, which the WCF Data Services Client does.

Creating a Relationship Between Order Product (salesorderdetail) and Service Activity (serviceappointment)

We are using Microsoft CRM 4.0 to run a consulting business. Its working pretty well but we want to simplify the way we are doing some things. What we want to do is create an Order (salesorder) with multiple Order Products (salesorderdetal). So good so far.
Next I want to be able associate each Order Product (salesorderdetail) with a Service Activity (serviceappointment), this representing that this billable line item in the order is actually going to be fulfilled as a consuting engagement.
The problem is, I can't seem to be able to create an association between the Order Product (salesorderdetail) and Service Activiy (serviceappointment). It simply doesn't appear in the drop downlist.
Can anyone think of a reason for this? I've seen some posts about relating field mapping between Quote Product, Order Product, Opportunity Product and Invoice Product, but that isn't quite what I am after.
Any suggestions gratefully received - even if it is an explaination of why its not possible.
I created a simple 1:N mapping from Case to Invoice. The Case records its ID and Title in custom fields in the Invoice. Unfortunately this does not allow for product creation as children of the Invoice, so that should be created as a custom code workflow.

Resources