Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

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

...

languagejson

...

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
languagejson
"settings":
{
  "getPartners": "1" // pour le verb GET et LIST permet de retourner les informations des partenaires de l'affaire
}

verb: GET
resultType: simple

Bloc de code
languagejson
  "deal":{
    "codedeal": "AFR000011",
    "customer_ID": "C0000001",
    "label": "Vitrine de magasin",
    "creationDate": "2021-12-01 00:00:00"
    "generictype_ID_dealType": "Type affaire 1",
    "generictype_ID_status": "STARTED",
    "dealNumber": "AFR000011"
  }

verb: GET
resultType: extended

Bloc de code
languagejson
  "deal":{
    "codedeal": "AFR000011",
    "customer_ID": "C0000001",
    "label": "Vitrine de magasin",
    "creationDate": "2021-12-01 00:00:00",
    "generictype_ID_dealType": "Type affaire 1",
    "generictype_ID_status": "STARTED",
    "dealNumber": "AFR000011",
    "description": "",    
    "closingDate": "",
    "amount": "300",
    "probability": "55",
    "customer_ID_introducer": "",
    "baseuser_ID": "MOREL",
    "amount2": "",
    "realClosingDate": "",
    "dealstep_ID_current": "",
    "deal_ID_origin": "",
    "manualProbability": "0",
    "marketinglead_ID_origin": "",
    "customercontact_ID": "C0000001-DJ"
  }

verb: GET
resultType: extendedRelated
en complément du résultat pour resultType: extended on aura le détail pour les tables generictype_deal_type, customer, customercontact, baseuser et generictype_status

Bloc de code
languagejson
"related":[
{
  "generictype_dealType":{
    "codegenerictype": "DEAL_DEALTYPE-AFR",
    "label": "Type affaire 1",
    "originalCode": "AFR",
    "dataType": "DEAL_DEALTYPE",
    "description": "",
    "codedealtranslationKey": "PJ000011",
    "customergenerictype_ID_parent": "Deal",
    "tag": "C0000001",
    "labelorderNumber":""
"Vitrine de magasin"},
    "generictype_ID_dealTypestatus": "Type projet 1{
    "codegenerictype": "DEAL_STATUS-3",
    "generictype_ID_statuslabel": "ACTIVEDémarré",
    "dealNumberoriginalCode": "PJ0000113",
    "isProjectdataType": "1"
  }

verb: GET
resultType: extended

Bloc de code
languagejson
DEAL_STATUS_V2",
    "dealdescription":{ "",
    "codedealtranslationKey": "PJ000011GenType_DEAL_STATUS_STARTED",
    "customergenerictype_ID_parent": "C0000001",
    "labeltag": "Vitrine de magasinSTARTED",
    "generictype_ID_dealTypeorderNumber": "Type projet 1",""
  },
  "customer":{
    "generictype_ID_statuscodecustomer": "ACTIVEC0000001",
    "dealNumbername": "ENTREPRISE DIJON GUICHARD"PJ000011",
    "isProjectbaseuser_ID": "1",
    "descriptionaddress1" :"33 Avenue du Drapeau"",
    "creationDateaddress2": "2020-09-18 00:00:00",
    "closingDateaddress3": "",
    "amountpostalCode": "30021000",
    "probabilitycity": "55DIJON",
    "generictype_ID_lossReasonphoneNumber": "03 90 11 22 33",
    "customer_ID_introducerfaxNumber": "03 90 11 22 44",
    "baseuser_IDmobilePhoneNumber": "06 90 11 22 33",
    "amount2email": "contact@guichard.com",
    "lossReasonCommentdeliveryDays": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5B",
    "realClosingDateopeningDays": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5B",
    "dealstep_ID_currentsiretNumber":" "",
    "deal_ID_originvatIntra": "",
    "manualProbabilityapeCode": "0516K",
    "marketinglead_ID_origincomment": "",
    "customercontact_IDblocked": "C0000001-DJ0",
  }

verb: GET
resultType: extendedRelated
en complément du résultat pour resultType: extended on aura le détail pour les tables generictype_deal_type, customer, customercontact, baseuser et generictype_status

Bloc de code
languagejson
"related":[
{  "blockedComment": "",
    "generictype_dealTypemessage":{ "",
    "codegenerictypevacationStart": "DEAL_DEALTYPE-PRJ",
    "labelvacationEnd": "Project type 1",
    "originalCodegpsLongitude": "PRJ5.04372",
    "dataTypegpsLatitude": "DEAL_DEALTYPE47.33222",
    "descriptionaccountNumber": "C0000001",
    "translationKeycontactName": "",
    "generictypecurrency_ID_parent": "Project",
    "tagauthorizedCredit": "0",
    "orderNumberrisk": "1",
  },  "underSurveillance": "customer":{,
    "codecustomerworkforce": "C000000125",
    "namecustomer_ID_paying": "ENTREPRISE DIJON GUICHARD",
    "baseuserpricecategory_ID": "",
    "address1discountRate": :"33 Avenue du Drapeau"0",
    "address2website": "https://www.guichard.com",
    "address3legalStatus": "Société Anonyme avec Directoire",
    "postalCodegenerictype_ID_brand": "21000",
    "citygenerictype_ID_deliveryMode": "DIJON",
    "phoneNumber": "03 90 11 22 33generictype_ID_paymentMean": "",
    "faxNumbergenerictype_ID_country": "03 90 11 22 44",
    "mobilePhoneNumbergenerictype_ID_province": "06 90 11 22 33",
    "emailgenerictype_ID_customerType": "contact@guichard.comCTC",
    "deliveryDays": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5Bgenerictype_ID_customerFamily": "",
    "openingDaysconfirmationEmail": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5Bcontact@guichard.com",
    "siretNumberconfirmationFax": "03 90 11 22 44",
    "vatIntragenerictype_ID_taxCode": "",
    "apeCodeproductdepot_ID": "516K",
    "commentgenerictype_ID_accountingCategory": "",
    "blockedgenerictype_ID_customerPotential": "0B",
    "blockedComment "generictype_ID_civility": "",
    "messageskype": "contact@guichard.com",
    "vacationStartgenerictype_ID_role": "",
    "vacationEndunused": "0",
    "gpsLongitudecustomergroup_ID": "5.04372",
    "gpsLatitudegenerictype_ID_referencing": "47.332222",
    "accountNumbergenerictype_ID_distribution": "C0000001SELF",
    "contactNamegenerictype_ID_market": "BIG",
    "currency_IDarea": "",
    "authorizedCreditbaseculture_ID": "0FR-FR",
    "riskbaseuser_ID_favoriteTechnician": "1TECH-01",
    "underSurveillancebranchoffice_ID": "SXB",
    "workforceemailFormat": "25",
    "customer_ID_payingisIndividual": "0",
    "pricecategory_IDfacebook": "https://www.facebook.com/guichard/",
    "discountRatetwitter": "0https://twitter.com/guichard",
    "websiteyoutube": "<httpshttps://www.guichardyoutube.com/watch?v=6jGbnEwQJ54",>
    "legalStatuslinkedin": "Société Anonyme avec Directoirehttps://www.linkedin.com/company/guichard",
    "generictype_ID_brandactivity": "",
  },
  "generictype_ID_deliveryModecustomercontact":{
"",
    "generictype_ID_paymentMeancodecustomercontact": "C0000001-DJ",
    "generictypecustomer_ID_country": "C0000001",
    "generictype_ID_provincelastName": "DENEIR",
    "generictype_ID_customerTypefirstName": "CTCJacques",
    "generictype_ID_customerFamilycivility": "",
    "confirmationEmail": "contact@guichard.comMonsieur",
    "confirmationFaxaddress1": "031b 90 11 22 44rue Darwin",
    "generictype_ID_taxCodeaddress2": "",
    "productdepot_IDaddress3": "",
    "generictype_ID_accountingCategorypostalCode": "21000",
    "generictype_ID_customerPotentialcity": "BDIJON",
    "generictype_ID_civilityphoneNumber": "05 55 79 56 92",
    "skypefaxNumber": "contact@guichard.com",05 55    "generictype_ID_role": ""79 56 11",
    "unusedmobilePhoneNumber": "006 07 08 09 10",
    "customergroup_IDemail": "jdeneir@nebout.div",
    "generictype_ID_referencinggpsLongitude": "25.0384",
    "generictype_ID_distributiongpsLatitude": "SELF47.33073",
    "generictype_ID_marketdescription": "BIGAcheteur direct",
    "areagenerictype_ID_position": "Direction",
    "baseculture_IDbirthday": "FR-FR1980-09-18 00:00:00",
    "baseusergenerictype_ID_favoriteTechniciancountry": "TECH-01FR",
    "branchofficegenerictype_ID_province": "SXB",
    "emailFormatmainContact": "0",
    "isIndividualgenerictype_ID_service": "0Direction",
    "facebookskype": "<https://www.facebook.com/guichard/",>
    "twitterbaseculture_ID": "<https://twitter.com/guichard",>
    "youtubebouncedEmailDetected": "<https://www.youtube.com/watch?v=6jGbnEwQJ54",>
    "linkedinclosedDate": "<https://www.linkedin.com/company/guichard",>"",
    "twitter": "",
    "activitylinkedin": ""
  },
  "customercontactbaseuser":{
    "codecustomercontactcodebaseuser":"25",
"C0000001-DJ    "lastName":"MOREL",
    "customer_IDfirstName":"Vincent",
"C0000001    "initials":"MV",
    "lastNamebaseusertree_ID":"Région "DENEIR2",
    "firstNameproductdepot_ID":"Dépôt Vincent MOREL"Jacques",
    "generictypeproductdepot_ID_civilitycurrent": "Monsieur",
    "address1email": "1b rue Darwin"vincent@morel.com",
    "address2phoneNumber": "",
    "address3faxNumber": "",
    "postalCodeaddress1": "21000",
    "cityaddress2": "DIJON",
    "phoneNumberpostalCode":"",
"05 55 79 56 92"city":"",
    "faxNumberposition": "05 55 79 56 11"Représentant",
    "mobilePhoneNumberdepartment":"Commercial",
"06 07 08 09 10 "structureNav":"1",
    "emailsupervisor": "jdeneir@nebout.div0",
    "gpsLongitudeuseMileageRate": "5.0384",
    "gpsLatitudeaccount": "47.33073",
    "descriptionanalyticSection": "Acheteur direct",
    "generictype_ID_positionlastGPSDate": "Direction",
    "birthdaygpsLongitude": "1980-09-18 00:00:00",
    "generictype_ID_countrygpsLatitude": "FR",
    "generictype_ID_provincegpsPrecision": "",
    "mainContactgpsUpdateDate": "0",
    "generictype_ID_servicegpsManual": "Direction",
    "skypegenerictype_ID_country": "",
    "baseculturegenerictype_ID_province": "",
    "bouncedEmailDetectedbaseculture_ID": "",
    "closedDatebranchoffice_ID": "",
    "twitterresourcetype_ID": "",
    "linkedinteamtype_ID": ""
  }
}]

verb: PUT

Bloc de code
languagejson
{
  "deal": {
    "codedeal": "PJ000011AFR000011", /* Code globalement unique de l'affaire (Varchar (255))*/
    "customer_ID": "C0000001", /* Code client (ForeignKey () - sw_data_customer.codecustomer)*/
    "label": "Vitrine de magasin", /* Libellé (Varchar (255))*/
    "generictype_ID_dealType": "DEAL_DEALTYPE-PRJAFR", /* Code type d'affaire (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = DEAL_DEALTYPE) et generictype_ID_parent = DEAL_DEALTYPE)*/
    "dealNumber": "PJ000011AFR000011", /* N° d'affaire (Varchar (64))*/
    "description": "", Description (Text (65535))*/
    "creationDate" : "2020-09-18", /* Date de création (DateTime ())*/
    "closingDate": "", /* Date de fin (DateTime ( (Text (65535))*/
    "amountcreationDate" : "3002021-12-01", /* MontantDate de création (DoubleDateTime ())*/
    "probabilityclosingDate": "55", /* ProbabilitéDate (ende %)fin (IntDateTime ())*/
    "generictype_ID_lossReasonamount": "300", /* Code raison de la perte (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = DEAL_LOSSREASONMontant (Double ())*/
    "lossReasonCommentprobability": "55", /* Probabilité Commentaire(en perte%) (TextInt (65535))*/
    "customer_ID_introducer": "", /* Code client apporteur d'affaire (ForeignKey () - sw_data_customer.codecustomer)
    "baseuser_ID": "25", /* Code responsable (ForeignKey () - sw_data_baseuser.codebaseuser)*/
    "amount2": "", /* Montant 2 (Double ())*/
    "generictype_ID_status": "DEAL_STATUS-13", /* Statut (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = DEAL_STATUS_V2)*/    
    "realClosingDate": "", /* Date de fin réelle (DateTime ())*/
    "dealstep_ID_current": "", /* Code étape actuelle (ForeignKey () - sw_data_dealstep.codedealstep)*/
    "deal_ID_origin": "", /* Code opportunité d'origine (ForeignKey () - sw_data_deal.codedeal)*/
    "isProject": "1", /* Opportunité (Valeurs possibles : 0,1) (Bool ()origine (ForeignKey () - sw_data_deal.codedeal)*/
    "manualProbability": "0", /* Probabilité manuelle (Valeurs possibles : 0,1) (Bool ())*/
    "marketinglead_ID_origin": "", /* Code lead marketing d'origine (ForeignKey () - sw_data_marketinglead.codemarketinglead)*/
    "customercontact_ID": "C0000001-DJ", /* Code contact client (ForeignKey () - sw_data_customercontact.codecustomercontact)*/	        
    "internalCodeDealinternalcodedeal": null, /* CodeDeal original de weavy s'il y a eu transcodage (Varchar (255)) */
    "internalcustomer_ID": null, /* CodeCustomer Code deal original de weavy s'il y a eu transcodage (Varchar (255)) */

     /* Optionnel : pour mettre à jour les champs dynamiques selon paramétrage */
    /* Exemple 1 : */
    "dynamicfields": 
    [{
      "fieldname": "prj10aff10",
      "fieldvalue": "100000"
    },
    {
      "fieldname": "prj30aff30",
      "fieldvalue": "Jean-René Abraham"    
    },
    {
      ...
    }]
    /* 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_prj10aff10": "100000",
    "v_prj30aff30": "Jean-René Abraham",
    ...
  },
  "dealelement": [
  {
    "codedealelement": "PJ000011AFR000011-0-1", /* Code globalement unique de l'élément d'affaire (Varchar (255))*/
    "deal_ID": "PJ000011AFR000011", /* Code affaire. Reprendre le code affaire du bloc json "deal" (ForeignKey () - sw_data_deal.codedeal)*/
    "label" : "Elément 1", /* Libellé (Varchar (255))*/ 
    "DataOrder": "10", /* Ordre d'affichage (Int ())*/
    "originalCode": "1", /* 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)*/
  },
  {
    "codedealelement": "PJ000011AFR000011-0-1.1", /* Code globalement unique de l'élément d'affaire (Varchar (255))*/ 
    "deal_ID": "PJ000011AFR000011", /* Code affaire. Reprendre le code affaire du bloc json "deal" (ForeignKey () - sw_data_deal.codedeal)*/
    "label" : "Elément 1.1", /* Libellé (Varchar (255))*/  
    "DataOrder": "11", /* Ordre d'affichage (Int ())*/ 
    "originalCode": "1.1", /* Code de l'élément d'affaire à afficher (Varchar (255))*/
    "dealelementstructure_ID": "", /* Code structure (ForeignKey () - sw_data_dealelementstructure.codedealelementstructure)*/
    "dealelement_ID_parent": "PJ000011AFR000011-0-1" /* Code élément d'affaire parent (nécessite que le parent a été créée avant celui-ci) (ForeignKey () - sw_data_dealelement.codedealelement)*/
  },
  {
    "codedealelement": "PJ000011AFR000011-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 , extendedRelated reprendre les définitions du GET

Bloc de code
languagejson
"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"

Valeur Valeurs possibles pour le tri "orderBy" :

  • dealNumberAsc : par n° d'affaire /opportunité 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 opportunité/ affaire (sw_data_deal) va supprimer en cascade les éléments dans la table liée sw_data_dealelement.