SAP b1 Service Layer - New Contact person for a Business Partner (REST API) - service-layer

Would anybody know how to create a new Contact Persons for a Business Partner via the Service Layer (REST API json) ?
Thanks

There's a "ContactEmployees" collections on the "BusinessPartner" entity. Send a PATCH request to the BP, something like:
PATCH https://server:50000/b1s/v1/BusinessPartners('C00001')
{
"ContactEmployees":
{
"Name": "Arthur Dent"
}
}
(I deleted my first answer because I confused BP contacts with the entity for 'activities' which is also referred to as 'contacts' in the API.)

Related

Is there a way to update and delete a Glip team or group?

I can retrieve a list of groups/teams or an individual one by using the chats API, but I cannot find how to update or delete a group or a team.
The GET APIs I use successfully include:
Get Chat List
GET https://platform.ringcentral.com/restapi/v1.0/glip/chats
Get Chat Info by ID
GET https://platform.ringcentral.com/restapi/v1.0/glip/chats/{chatId}
However, when I try to call PATCH or DELETE on the Chat ID API endpoint I receive a 404. Is there a way to delete a Glip team or group?
chats is a new endpoint to cover both Groups and Teams, however PATCH and DELETE have not been implemented on it yet.
Update Team
To update a team, use the old teams endpoint. The teamId below are the same as the chatId provided in the id property returned by the "Get Chat List" API.
Only the following body parameters are supported. Use the one(s) you wish to update.
PATCH https://platform.ringcentral.com/restapi/v1.0/glip/teams/{teamId}
{
"public": true,
"name": "My New Team Name",
"description": "My Fancy Team"
}
A successful PATCH will return a 200 OK response with a JSON body of the team properties.
Delete Team
To delete a team, use the old teams endpoint. The teamId below are the same as the chatId provided in the id property returned by the "Get Chat List" API.
DELETE https://platform.ringcentral.com/restapi/v1.0/glip/teams/{teamId}
A successful response will result in a 204 No Content response status code.
Update Group
There is no option to update a group as it is just a chat with multiple participants.
Delete Group
It is not possible to delete a Group or a PrivateChat. Attempting to do so will result in the error below. To delete a Group, convert it to a Team first and then delete it.
HTTP 400 Bad Request
{
"errors": [
{
"errorCode": "CNV-001",
"message": "Conversation with type [Group] cannot be deleted."
}
]
}

OTRS fetch info from url

I've OTRS 5 working fine . I need to retrieve information from web
for example I received emails from support team they put in the subject (customer ID) I need to put in the body message of the Ticket the customer information based on Customer ID which will fetch it from another local system through Url e.x "skldfj.com/dslkde.php?id=23487893"
for example I received ticket in subject: customer 23487893 have issue
in body need to be something like
hello team this customer (ID 23487893) have issue
customer info (fetch it from skldfj.com/dslkde.php?id=23487893)
name
telephone and more

CA Service Desk Update SR Request fields

I am able to create a Service Request on CA service desk using the webservices. Now I have been given a task to update the request fields , specifically the status field which is a dropdown
I wanted to know , which method of the web service I can use to achieve this. I have been searching for the required method for quite some time , I tried out the updateObject webservice method , but that throws an exception.
Rubberduck Moment
I resolved this using the updateObject() of the webservice and passed a string array like below
{ "description" , "Some Test description" , "category", "pcat:448727",
"summary","","customer","","type","R","priority","0","znetid",affUserId,"status","CNCL"};

RESTFUL Web Service - List

I have a client application requesting a list of channels from a webservice. Is it possible to take the "response" from the web service and store it in an ArrayList?
Meaning if I wanted to store a list of channels for example, it would normally come from the web service as a response, typically from ResponseBuilder.
And I want to store it in an ArrayList from the client, like List.
How would I go about doing that?
You can use TypeReference to instantiate your Channel object list, here is an example:
import com.fasterxml.jackson.core.type.TypeReference;
public class ChannelClient {
public void getChannels() {
Response serviceResponse = client.target("http://your_service_url/channels/").
request(MediaType.APPLICATION_JSON).get(Response.class);
String responseString = serviceResponse.readEntity(String.class);
List<Channel> list = new ObjectMapper().readerFor(new TypeReference<List<Channel>>() {
}).readValue(responseString);
}
}
Make sure to have Jersey JSON Jackson jar in your dependencies, you can get it from here
https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-json-jackson/2.26-b07
EDIT: In case you want to consume MediaType.TEXT_PLAIN response, you will just change the request method argument to your specified type like this:
Response serviceResponse = client.target("http://your_service_url/channels/").
request(MediaType.TEXT_PLAIN).get(Response.class);

Can't Get 1:m VTiger Relationship to Show on "1" Side

I am trying to implement a 1:m relationship between Contacts & Service Contracts in VTiger 6. We will use the relationship to track Users of our system. Each Contact should only be allowed to be link to 1 Service Contract at a time (1:m).
I was able to get the ServiceContract side of this working by using the following code:
require_once 'vtlib/Vtiger/Module.php';
$scmodule=Vtiger_Module::getInstance('ServiceContracts');
$scmodule->setRelatedList(Vtiger_Module::getInstance('Contacts'), 'Users',Array('SELECT'),'get_related_list');
This added a tab on the right side of Service Contracts titled "Users" with a SELECT button and allows us to ADD/REMOVE Contacts from the list.
However, what we would also like is to have a field on the Contacts page that shows which Service Contract they are linked to.
UPDATE:
I used the following code to add a single Service Contract field to Contacts:
`
include_once('vtlib/Vtiger/Module.php');
$module = Vtiger_Module::getInstance('Contacts');
$blockInstance = Vtiger_Block::getInstance('LBL_CONTACT_INFORMATION', $module);
$fieldInstance = new Vtiger_Field();
$fieldInstance->name = 'SelectYourAccount';
$fieldInstance->label = 'Account';
$fieldInstance->uitype = 10;
$fieldInstance->typeofdata = 'V~O';
$blockInstance->addField($fieldInstance);
$fieldInstance->setRelatedModules(Array('ServiceContracts'));`
The above code worked fine and I have an Account field in contact details that I can link to a single Service Contract; however, when I select a Service Contract for a Contact and then go to the Users list on the Service Contract, the Contact isn't listed.
Any help would be greatly appreciated!
What i understand from your Question is that Contact is your "1" module and Service Contract is "M(Multi Record)" module. Which means 1 Contact will have multiple Service Contract. So in vtiger Service Contract Related List is already given under Contact Module.Please check this image below.
Next in Service Contract you will have Option to select Contact so that Contract will be liked with "1" Contact. See Screenshot here.
I Hope you will get clear picture after reading this of Relation in Vtiger.