Skip to content

Commit

Permalink
complete salesforce integration document
Browse files Browse the repository at this point in the history
  • Loading branch information
taodong committed Jul 5, 2024
1 parent 2459ee1 commit 08ff59f
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 2 deletions.
10 changes: 9 additions & 1 deletion docs/plan/data-provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ This provider generates random address
</Tabs>

## Email Provider
This provider generates random email address
This provider generates random email address.

- **category**: email

```yaml title="Create email address"
Expand All @@ -121,6 +122,13 @@ This provider generates random email address
- type: "category"
name: "email"
```
:::note
Our default Email provider generates Gmail type email addresses with four parts `<prefix>.<suffix>@<domain>.<domain_type>`, e.g. `[email protected]`
- prefix: 3 to 8 character long random string
- suffix: 3 to 8 character long random string
- domain: 3 to 8 character long random string
- domain_type: random value from "com", "info", "org", "net", "inc", "app", "ai" or "io"
:::

## Id Provider
This provider generates random ID string with given format, if no format is provided, it generates UUID
Expand Down
160 changes: 159 additions & 1 deletion docs/third-party/salesforce.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ sidebar_clas_name: green
---

import useBaseUrl from '@docusaurus/useBaseUrl';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Salesforce

Expand Down Expand Up @@ -34,4 +36,160 @@ The supported data types for Salesforce are:
**Sample Data Order**
- <a target="_blank" href={useBaseUrl("/files/salesforce-types/schema.yaml")} download="schema.yaml">schema file</a>
- <a target="_blank" href={useBaseUrl("/files/salesforce-types/plan.yaml")} download="plan.yaml">plan file</a>
- <a target="_blank" href={useBaseUrl("/files/salesforce-types/plan.yaml")} download="plan.yaml">plan file</a>
### Checkbox
Salesforce checkbox data type is mapped by a boolean data type.
```yaml title="Checkbox"
properties:
- name: "My_CheckBox__c"
type: "boolean"
```
### Currency
Salesforce currency data type is mapped by a number data type with [precision](../schema/constraints#precision) constraint.
```yaml title="Currency"
# A currency amount with 2 digits of precision, such as dollar
properties:
- name: "My_Currency__c"
type: "number"
constraints:
- type: "precision"
max: 2
```
### Date
Salesforce date data type is mapped by a date data type.
```yaml title="Date"
properties:
- name: "My_Date__c"
type: "date"
```
### Date/Time
Salesforce date/time data type is mapped by a datetime data type.
```yaml title="Date/Time"
properties:
- name: "My_DateTime__c"
type: "datetime"
```
### Email
Salesforce email data type is mapped by a text data type with our [email](../plan/data-provider#email-provider) data provider(one of `category` constraint).

```yaml title="Email"
properties:
- name: "My_Email__c"
type: "text"
constraints:
- type: "category"
name: "email"
```

### Number
Salesforce number data type is mapped by a number data type. For non-integer number, you need to apply the [precision](../schema/constraints#precision) constraint too.

```yaml title="Number"
properties:
- name: "My_Number__c"
type: "number"
constraints:
- type: "precision"
max: 3
```

### Percent
Salesforce percent data type is mapped by a number data type with both [precision](../schema/constraints#precision) and [range](../schema/constraints#range) constraints.

```yaml title="Percent"
properties:
- name: "My_Percent__c"
type: "number"
constraints:
- type: "range"
min: 0
max: 100
- type: "precision"
max: 2
```

### Phone
The Salesforce phone data type is mapped by a text data type. Although we don’t have a built-in phone provider, it can be easily implemented using an [ID](../plan/data-provider#id-provider) provider with a specific format.

```yaml title="Phone"
properties:
- name: "My_Phone__c"
type: "text"
constraints:
- type: "category"
name: "id"
- type: "format"
format: "(###) ###-####"
```
:::tip
For more advanced way to generate phone number, you can use join function provided by [string alternation](../plan/string-alternation#concatenation) instead.
:::

### Picklist
The Salesforce picklist data type is mapped by a text data type, and the picklist values are listed using [value distribution](../plan/property-spec#value-distribution).

<Tabs defaultValue="plan" groupId="picklist">
<TabItem value="schema" label="Define Picklist Field">
```yaml title="Define Picklist Field"
properties:
- name: "My_Pick__c"
type: "text"
```
</TabItem>
<TabItem value="plan" label="List Picklist Values">
```yaml title="List Values in Plan File"
properties:
- name: "My_Pick__c"
values:
- values:
- "val1"
- "val2"
- "val3"
weight: 1.0
```
</TabItem>
</Tabs>

### Text
The Salesforce text data type is mapped by a text data type.

```yaml title="Text"
properties:
- name: "My_Text__c"
type: "text"
```

### Time
The Salesforce time data type is mapped by a time data type.

```yaml title="Time"
properties:
- name: "My_Time__c"
type: "time"
```

### URL
The Salesforce phone data type is mapped by a text data type. Though we don't have a url provider, the value can be generated by using an [ID](../plan/data-provider#id-provider) provider with a specific format.

```yaml title="URL"
properties:
- name: "My_URL__c"
type: "text"
constraints:
- type: "category"
name: "id"
- type: "format"
format: "https://www.?????????.com"
```
:::tip
For more advanced way to generate url, you can use join function provided by [string alternation](../plan/string-alternation#concatenation) instead.
:::

0 comments on commit 08ff59f

Please sign in to comment.