Résumé
Manipulation de l'entité entité Deal (Opportunités/Affaires) en en lecture/écriture/suppression via un objet métier depuis une application externe.
Remarque
A partir de la Summer'22, le webhook Deal a été scindé en deux afin de gérer les opportunités séparément. Il faudra donc à présent utiliser le nouveau webhook Opportunity pour cette partie.
Tables
Les tables utilisées sont :
sw_data_deal : Table des opportunités/affaires
Les tables liées sont :
sw_data_dealelement : Table des éléments d'
opportunité/affaire
Critères d'activation
WHK_Deal est est défini dans la gestion des webhooks du studio.
...
Règles métier
verb: GET
resultType: simple
...
PUT
La date de création est mise par défaut à la date du jour (creationDate) si non fournie lors d'une création
Le statut est mis par défaut à 'Brouillon' (generictype_ID_status = DRAFTING) si non fourni lors d'une création
Fonctionnement
settings parameters
Bloc de code | ||
---|---|---|
| ||
"settings": { " codedealgetPartners": "PJ000011 1", // pour le"customer_ID": "C0000001", "label": "Vitrine de magasin", verb GET et LIST permet de retourner les informations des partenaires de l'affaire
} |
verb: GET
resultType: simple
Bloc de code | ||
---|---|---|
| ||
"deal":{ "generictype_ID_dealType codedeal": "Type projet 1 AFR000011", "generictype customer_ID_status ": "ACTIVE C0000001", "dealNumber label": "PJ000011 Vitrine de magasin", "isProject creationDate": "1" } |
verb: GET
resultType: extended
Info |
---|
"deal":{2021-12-01 00:00:00" "codedeal generictype_ID_dealType": "PJ000011 Type affaire 1", "customer generictype_ID_status": "C0000001 STARTED", "label dealNumber": "Vitrine de magasin AFR000011",
"generictype_ID_dealType": "Type projet 1",} |
verb: GET
resultType: extended
Bloc de code | ||
---|---|---|
| ||
"deal":{ "generictype_ID_status codedeal": "ACTIVE AFR000011", "dealNumber customer_ID": "PJ000011 C0000001", "isProject label": "1", Vitrine"description": " de magasin", "creationDate": "2020 2021-09 12-18 01 00:00:00", "closingDate generictype_ID_dealType": "Type affaire 1", "amount generictype_ID_status": "STARTED", "dealNumber": "300 AFR000011", "probability description": "", "closingDate": "55 ", "generictype_ID_lossReason amount": "300", "customer_ID_introducer probability": "55", "baseuser customer_ID_introducer": "", "amount2 baseuser_ID": "MOREL", "lossReasonComment amount2": "", "realClosingDate": "", "dealstep_ID_current": "", "deal_ID_origin": "", "manualProbability": "0", "marketinglead_ID_origin": "", "customercontact_ID": "C0000001-DJ" } |
Verbverb: GET
resultType: extendedRelated
en complément du résultat pour resultType: extended on aura le détail pour les tables tables generictype_deal_type, customer, customercontact, baseuser et generictype_status
Infocode | ||
---|---|---|
| ||
"related":[ { "generictype_dealType":{ "codegenerictype": "DEAL_DEALTYPE-PRJ AFR", "label": "Project Typetype affaire 1", "originalCode": "PRJ AFR", "dataType": "DEAL_DEALTYPE", "description": "", "translationKey": "", "generictype_ID_parent": "Project Deal", "tag":"", "orderNumber":"" }, "customer generictype_status": { "codecustomer codegenerictype": "C0000001 DEAL_STATUS-3", "name label": "ENTREPRISE DIJON GUICHARD Démarré", "baseuser_ID originalCode": "3", "address1 dataType"::"33 Avenue du Drapeau "DEAL_STATUS_V2", "address2 description": "", "address3 translationKey": "GenType_DEAL_STATUS_STARTED", "postalCode generictype_ID_parent": "21000 ", "city tag": "DIJON STARTED", "phoneNumber orderNumber": "03 90 11 22 33", " }, "customer":{ "faxNumber codecustomer": "03 90 11 22 44 C0000001", "name": "ENTREPRISE DIJON GUICHARD", "mobilePhoneNumber baseuser_ID": "06 ",90 11 22"address1" :"33 Avenue du Drapeau", "email address2": "contact@guichard.com ", "deliveryDays address3": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5B ", "openingDays postalCode": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5B 21000", "siretNumber city": " DIJON", "vatIntra phoneNumber": "03 90 11 22 33", "apeCode faxNumber": "516K 03 90 11 22 44", "comment mobilePhoneNumber": "" 06 90 11 22 33", "blocked email": "0 contact@guichard.com", "blockedComment deliveryDays": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5B", "message openingDays": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5B", "vacationStart siretNumber":" "" , "vacationEnd vatIntra": "", "gpsLongitude apeCode": "5.04372 516K", "gpsLatitude comment":"47.33222 "", "blocked": "0", "accountNumber blockedComment": "C0000001 ", "contactName message": "", "currency_ID vacationStart": "", "authorizedCredit vacationEnd": "0 ", "risk gpsLongitude": "1 5.04372", "underSurveillance gpsLatitude": "47.33222", "workforce accountNumber": "25 C0000001", "customer_ID_paying contactName": "", "pricecategory currency_ID": "", "discountRate authorizedCredit": "0", "website risk": "https://www.guichard.com 1", "legalStatus underSurveillance": "Société Anonyme avec Directoire ", "generictype_ID_brand workforce": "25", "generictype customer_ID_deliveryMode paying": "", "generictype pricecategory_ID_paymentMean ": "", "generictype_ID_country discountRate": "0", "generictype_ID_province website": "https://www.guichard.com", "generictype_ID_customerType legalStatus": "CTC Société Anonyme avec Directoire", "generictype_ID_customerFamily brand": "", "confirmationEmail generictype_ID_deliveryMode": "contact@guichard.com ", "confirmationFax generictype_ID_paymentMean": "03 ",90 11 22 44",
"generictype_ID_ taxCodecountry": "", "productdepot generictype_ID_province": "", "generictype_ID_accountingCategory customerType": "CTC", "generictype_ID_customerPotential customerFamily": "B ", "generictype_ID_civility confirmationEmail": "contact@guichard.com", "skype confirmationFax": "contact@guichard.com 03 90 11 22 44", "generictype_ID_role taxCode": "", "unused productdepot_ID": "0 ", "customergroup generictype_ID_accountingCategory": "", "generictype_ID_referencing customerPotential": "2 B", "generictype_ID_distribution civility": "SELF ", "generictype_ID_market skype": "BIG contact@guichard.com", "area generictype_ID_role": "", "baseculture_ID unused": "FR-FR 0", "baseuser customergroup_ID_favoriteTechnician ": "TECH-01 ", "branchoffice generictype_ID_referencing": "SXB 2", "emailFormat generictype_ID_distribution": "SELF", "isIndividual generictype_ID_market": "0 BIG", "facebook area": "https://www.facebook.com/guichard/ ", "twitter baseculture_ID": "https://twitter.com/guichard FR-FR", "youtube baseuser_ID_favoriteTechnician": "https://www.youtube.com/watch?v=6jGbnEwQJ54 TECH-01", "linkedin branchoffice_ID": "https://www.linkedin.com/company/guichard SXB", "activity emailFormat": "",}, "isIndividual": "customercontact 0":{ , "codecustomercontact facebook": "C0000001-DJ https://www.facebook.com/guichard/", "twitter"customer_ID" : "C0000001 https://twitter.com/guichard", "lastName youtube": "DENEIR https://www.youtube.com/watch?v=6jGbnEwQJ54", "firstName linkedin": "Jacques https://www.linkedin.com/company/guichard", "generictype_ID_civility activity": "Monsieur " ,}, "address1 customercontact":"1b {rue Darwin", " address2codecustomercontact": "C0000001-DJ", "address3 customer_ID": "C0000001", "postalCode lastName": "21000 DENEIR", "city firstName": "DIJON Jacques", "phoneNumber generictype_ID_civility": "05 55 79 56 92 Monsieur", "faxNumber address1": "05 1b55 79 56 11 rue Darwin", "mobilePhoneNumber address2": "06 07 08 09 10 ", "email address3": "jdeneir@nebout.div ", "gpsLongitude postalCode": "5.0384 21000", "gpsLatitude city": "47.33073 DIJON", "description phoneNumber": "Acheteur direct 05 55 79 56 92", "generictype_ID_position faxNumber": "Direction 05 55 79 56 11", "birthday mobilePhoneNumber": "1980-09-18 00:00:00 06 07 08 09 10", "generictype_ID_country email": "FR jdeneir@nebout.div", "generictype_ID_province gpsLongitude": "5.0384", "mainContact gpsLatitude": "0 47.33073", "generictype_ID_service description": "Acheteur direct", "generictype_ID_position": "Direction", "skype birthday": "1980-09-18 00:00:00", "baseculture generictype_ID_country": "FR", "bouncedEmailDetected generictype_ID_province": "", "closedDate mainContact": "0", "twitter generictype_ID_service": "Direction", "linkedin skype": "" ,} }] |
verb: PUT
Info |
---|
{"deal baseculture_ID":{ "", "codedeal bouncedEmailDetected": "PJ000011 ",/* Code globalement unique de l'affaire (Varchar (255))*/"closedDate": "", "customer_ID twitter": "C0000001 ",/* Code client (ForeignKey () - sw_data_customer.codecustomer)*/
"linkedin": "" }, "label baseuser":{"Vitrine de magasin"codebaseuser":"25",/* Libellé (Varchar (255))*/"lastName":"MOREL", "generictype_ID_dealType firstName": " DEAL_DEALTYPE-PRJVincent",/* Code type d'affaire (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = DEAL_DEALTYPE)*/"initials":"MV", "baseusertree_ID":"Région 2", "dealNumber productdepot_ID":"Dépôt Vincent MOREL"PJ000011" ,
/* N° d'affaire (Varchar (64))*/"productdepot_ID_current":"", "description email": "vincent@morel.com",Description (Text (65535))*/ "creationDate phoneNumber" : "2020-09-18""",/* Date de création (DateTime ())*/
"faxNumber":"", "closingDate address1": "",/* Date de fin (DateTime ())*/"address2":"", "amount postalCode": " 300",/* Montant (Double ())*/ "probability city": " 55",/* Probabilité (en %) (Int ())*/"position":"Représentant", " generictype_ID_lossReasondepartment": "Commercial",/* Code raison de la perte (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = DEAL_LOSSREASON)*/
"structureNav":"1", "supervisor":"0", "useMileageRate":"", "lossReasonComment account": "",/* Commentaire perte (Text (65535))*/"analyticSection":"", "customer_ID_introducer lastGPSDate": "",/* Code client apporteur d'affaire (ForeignKey () - sw_data_customer.codecustomer)"gpsLongitude":"", "gpsLatitude":"", "baseuser_ID gpsPrecision": "",/* Code responsable (ForeignKey () - sw_data_baseuser.codebaseuser)*/"gpsUpdateDate":"", "amount2 gpsManual": "",/* Montant 2 (Double ())*/"generictype_ID_country":"", "generictype_ID_status province": " DEAL_STATUS-PRJ-1",Statut
(ForeignKey () - sw_data_generictype.codegenerictype avec datatype = DEAL_STATUS)*/ "baseculture_ID":"", " realClosingDatebranchoffice_ID": "",/* Date de fin réelle (DateTime ())*/"resourcetype_ID":"", "dealstep teamtype_ID_current ": "" ,
/* Code étape actuelle (ForeignKey () - sw_data_dealstep.codedealstep)*/}
}] |
verb: PUT
Bloc de code | ||
---|---|---|
| ||
{ "deal": { "deal_ID_origin codedeal": "AFR000011", /* Codeopportunité d'origine globalement unique de l'affaire (ForeignKey Varchar () - sw_data_deal.codedeal 255))*/ "isProject customer_ID": "1 C0000001", /*Opportunité Code client (Valeurs possibles : 0,1 ForeignKey ()(Bool ()) - sw_data_customer.codecustomer)*/ "manualProbability label": "0 Vitrine de magasin", /*Probabilité Libellémanuelle ( Valeurs possibles : 0,1) (Bool (Varchar (255))*/ "marketinglead generictype_ID_origin dealType": "DEAL_DEALTYPE-AFR", /* Codelead typemarketing d' origineaffaire (ForeignKey () - sw_data_marketinglead.codemarketinglead)*/ "customercontact_ID": "C0000001-DJ generictype.codegenerictype avec datatype = DEAL_DEALTYPE) et generictype_ID_parent = DEAL*/ "dealNumber": "AFR000011", /*Code contact client N° d'affaire (ForeignKey Varchar () - sw_data_customercontact.codecustomercontact 64))*/ "description": "", Description (Text (65535))*/ "internalCodeDeal creationDate" :null "2021-12-01", /*CodeDeal Dateoriginal de weavy s'il y a eu transcodage (Varchar (255)) création (DateTime ())*/ "internalcustomer_ID closingDate":null "", /*CodeCustomer Dateoriginal de weavy s'il y a eu transcodage (Varchar (255)) fin (DateTime ())*/ "amount": "300", /*Optionnel Montant: pour mettre à jour les champs dynamiques selon paramétrage (Double ())*//* Exemple 1 : */ "dynamicfields": [{ "probability": "55", /* Probabilité (en %) (Int ())*/ " fieldnamecustomer_ID_introducer": "prj10 ", /* Code client apporteur d'affaire (ForeignKey () -"fieldvalue sw_data_customer.codecustomer) "baseuser_ID": "100000" } 25", /* Code responsable (ForeignKey{ () - sw_data_baseuser.codebaseuser)*/ "fieldname amount2": "prj30 ", /* Montant 2 (Double ())*/"fieldvalue": "Jean-René Abraham" }, generictype_ID_status": "DEAL_STATUS-3", /* Statut (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = DEAL_STATUS_V2)*/{ "realClosingDate":... }] "", /* Date de fin réelle (DateTime ())*//* Exemple 2 : */ /* A partir de la version SUMMER'21, le mappage direct des champs dynamiques est possible en utilisant le nom du champ en bdd */ "v_prj10": "100000", "dealstep_ID_current": "", /* Code étape actuelle (ForeignKey () - sw_data_dealstep.codedealstep)*/ "deal_ID_origin": "", /* Code opportunité d'origine (ForeignKey () - sw_data_deal.codedeal)*/ "manualProbability": "0", /* Probabilité manuelle (Valeurs possibles : 0,1) (Bool ())*/ "v marketinglead_ID_prj30 origin": "Jean-René Abraham ", /* Code lead... }, "dealelement": [ { "codedealelement marketing d'origine (ForeignKey () - sw_data_marketinglead.codemarketinglead)*/ "customercontact_ID": "PJ000011 C0000001-0-1 DJ", /* Codeglobalement unique de l'élément d'affaire contact client (Varchar ForeignKey (255) ) - sw_data_customercontact.codecustomercontact)*/"deal_ID "internalcodedeal":"PJ000011", null /* Codeaffaire. dealReprendre originalle decode weavyaffaire s'ildu ybloc ajson eu"deal" transcodage (ForeignKey Varchar (255)- sw_data_deal.codedeal) ) */ /*"label" Optionnel :"Elément 1", /* Libellé (Varchar (255))*/ "DataOrder": "10", pour mettre à jour les champs dynamiques selon paramétrage */ /*Ordre Exempled'affichage (Int ()) 1 : */ "originalCode dynamicfields":"1",
/* Code de l'élément d'affaire à[{afficher (Varchar (255))*/"dealelementstructure_ID fieldname": "aff10",/* Code structure (ForeignKey () - sw_data_dealelementstructure.codedealelementstructure)*/ "fieldvalue": "100000" }, { "dealelement_ID_parent fieldname": "aff30",/* Code élément d'affaire parent (nécessite que le parent a été créée avant celui-ci) (ForeignKey () - sw_data_dealelement.codedealelement)*/
},
{
"codedealelement": "PJ000011-0-1.1", /* Code globalement unique de l'élément d'affaire (Varchar (255))"fieldvalue": "Jean-René Abraham" }, { ... }] /* Exemple 2 : */"deal_ID": "PJ000011", /* Code affaire. Reprendre le code affaire du bloc json "deal" (ForeignKey () - sw_data_deal.codedeal) /* A partir de la version SUMMER'21, le mappage direct des champs dynamiques est possible en utilisant le nom du champ en bdd */ "label v_aff10" : "Elément 1.1 100000", "v_aff30": "Jean-René Abraham",/* Libellé (Varchar (255))*/ ... }, "DataOrder dealelement":"11", /* Ordre d'affichage (Int ())*/ [ { " originalCodecodedealelement": "AFR000011-0-1.1 ", /* Code globalement unique de l'élément d'affaireà afficher ( (Varchar (255))*/ "dealelementstructure deal_ID": "AFR000011", /* Codestructure affaire. Reprendre le code affaire du bloc json "deal" (ForeignKey () - sw_data_dealelementstructure deal.codedealelementstructure codedeal)*/ "dealelement_ID_parent label" : "PJ000011-0- Elément 1", /*Code élément d'affaire parent (nécessite que le parent a été créée avant celui-ci) (ForeignKey () - sw_data_dealelement.codedealelement Libellé (Varchar (255))*/ "DataOrder": "10", /* Ordre d'affichage (Int ())*/}, {
"codedealelement"originalCode": "PJ000011-0-2 1", /* Codeglobalement unique de l'élément d'affaire à afficher (Varchar (255))*/ "deal dealelementstructure_ID": "PJ000011 ", /* Codeaffaire. structureReprendre (ForeignKeyle ()code affaire du bloc json "deal" (ForeignKey () - sw_data_deal.codedeal - sw_data_dealelementstructure.codedealelementstructure)*/"label" : "Elément 2",
/* Libellé (Varchar (255))*/ "DataOrder"dealelement_ID_parent": "20 " , /* OrdreCode élément d'affichage affaire parent (Int ()) nécessite que le parent a été créée avant celui-ci) (ForeignKey () - sw_data_dealelement.codedealelement)*/ }, { "originalCode codedealelement": "2 AFR000011-0-1.1", /* Code globalement unique de l'élément d'affaireà afficher (Varchar (255))*/ "dealelementstructure deal_ID": "AFR000011", /* Codestructure affaire.(ForeignKey Reprendre() le code affaire du bloc json "deal" (ForeignKey () - sw_data_dealelementstructure deal.codedealelementstructure codedeal)*/ "dealelement_ID_parent label" : "Elément 1.1", /*Code Libelléélément d'affaire parent (nécessite que le parent a été créée avant celui-ci) (ForeignKey () - sw_data_dealelement.codedealelement (Varchar (255))*/ "DataOrder": "11", /* Ordre d'affichage (Int ())*/}] } |
verb: LIST
resultType: simple, extended, extendedRelated reprendre les définitions du GET
Info |
---|
"filters:" { " codeDealoriginalCode": "value 1.1",filter /*is Codeequal de l'élément"label": "value", filter is contains d'affaire à afficher (Varchar (255))*/ "codeCustomer dealelementstructure_ID": "value ",filter /*is Codeequal structure (ForeignKey"dealType": "value", filter is equal () - sw_data_dealelementstructure.codedealelementstructure)*/ "codeStatus dealelement_ID_parent": "value AFR000011-0-1"filter /*is equal } Code élément d'affaire parent (nécessite que le parent a été créée avant celui-ci) (ForeignKey () - sw_data_dealelement.codedealelement)*/
},
{
"codedealelement": "AFR000011-0-2", /* Code globalement unique de l'élément d'affaire (Varchar (255))*/
"deal_ID": "PJ000011", /* Code affaire. Reprendre le code affaire du bloc json "deal" (ForeignKey () - sw_data_deal.codedeal)*/
"label" : "Elément 2", /* Libellé (Varchar (255))*/
"DataOrder": "20", /* Ordre d'affichage (Int ())*/
"originalCode": "2", /* Code de l'élément d'affaire à afficher (Varchar (255))*/
"dealelementstructure_ID": "", /* Code structure (ForeignKey () - sw_data_dealelementstructure.codedealelementstructure)*/
"dealelement_ID_parent": "" /* Code élément d'affaire parent (nécessite que le parent a été créée avant celui-ci) (ForeignKey () - sw_data_dealelement.codedealelement)*/
}]
} |
verb: LIST
resultType: simple, extended reprendre les définitions du GET
Bloc de code | ||
---|---|---|
| ||
"filters:" {
"codeDeal": "value", filter is equal
"dealNumber": "value", filter is equal
"label": "value", filter is contains
"creationDate": "value", filter is greater or equal to
"creationDateBetween": "value1|value2", filter is between value1 and value2
"codeCustomer": "value", filter is equal
"dealType": "value", filter is equal
"codeStatus": "value" filter is equal
},
"orderBy": "value" |
Valeurs possibles pour le tri "orderBy" :
dealNumberAsc : par n° d'affaire ascendant
labelAsc : par intitulé ascendant
creationDateAsc : par date de création ascendant
creationDateDesc : par date de création descendant
verb: DELETE
Une suppression d'une affaire (sw_data_deal) va supprimer en cascade les éléments dans la table liée sw_data_dealelement.