Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Salesforce usability improvements #12697

Merged
merged 132 commits into from
Aug 5, 2024
Merged

Conversation

GTFalcao
Copy link
Collaborator

@GTFalcao GTFalcao commented Jul 3, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced management of Salesforce records with structured property management and validation.
    • Introduction of improved property management for Salesforce opportunities, accounts, cases, comments, tasks, and users.
    • New user properties module for better management of user data.
  • Bug Fixes

    • Updated property names for clarity and consistency in actions.
    • Improved error handling and messaging for user feedback across various actions.
  • Documentation

    • Updated description fields to provide clearer explanations and direct links to relevant documentation.
    • Streamlined documentation for new features and changes to ensure users are informed of updates.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (1)
components/salesforce_rest_api/common/sobjects/case.mjs (1)

38-195: Missing Definition for FeedItemId

The property FeedItemId is used in components/salesforce_rest_api/common/sobjects/case.mjs, but its definition is missing from commonProps or elsewhere in the codebase. Please ensure that FeedItemId is correctly defined in the appropriate file.

  • components/salesforce_rest_api/common/sobjects/case.mjs
Analysis chain

Ensure Correctness of Common Property Imports

The properties in extraProps are well-defined and make use of commonProps. Verify that the imported properties are correctly defined in commonProps.


Let's reattempt the verification by adjusting the script to avoid specifying the file type, which caused the previous error.


The verification script successfully found definitions for most of the properties in commonProps, except for FeedItemId. We need to verify the definition of FeedItemId to ensure completeness.


Let's perform a broader search across the entire codebase to locate the definition of FeedItemId.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of common property imports.

# Test: Search for the definitions of common properties in the `commonProps` file. Expect: Correct definitions.
rg --type javascript 'AccountId|BusinessHoursId|CommunityId|ContactId|FeedItemId|CaseId|QuestionId|RecordTypeId|UserId' components/salesforce_rest_api/common/props-async-options.mjs

Length of output: 218


Script:

#!/bin/bash
# Description: Verify the correctness of common property imports.

# Test: Search for the definitions of common properties in the `commonProps` file. Expect: Correct definitions.
rg 'AccountId|BusinessHoursId|CommunityId|ContactId|FeedItemId|CaseId|QuestionId|RecordTypeId|UserId' components/salesforce_rest_api/common/props-async-options.mjs

Length of output: 291


Script:

#!/bin/bash
# Description: Verify the definition of FeedItemId in the commonProps file.

# Test: Search for the definition of FeedItemId in the commonProps file. Expect: Correct definition.
rg 'FeedItemId' components/salesforce_rest_api/common/props-async-options.mjs

Length of output: 77


Script:

#!/bin/bash
# Description: Locate the definition of FeedItemId across the entire codebase.

# Test: Search for the definition of FeedItemId across the entire codebase. Expect: Correct definition.
rg 'FeedItemId'

Length of output: 178

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c6cb436 and f02fbbb.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (10)
  • components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/account.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/campaign.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/case.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/contact.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/event.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/lead.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/opportunity.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/task.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/user.mjs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • components/salesforce_rest_api/common/sobjects/user.mjs
Additional comments not posted (51)
components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs (5)

1-3: LGTM! Import statements are appropriate.

The imports of common, getProps, attachment, and fs are necessary for the functionality described.


5-5: LGTM! docsLink constant is correctly defined.

The docsLink provides a useful reference to the Salesforce documentation.


8-14: LGTM! Usage of getProps and restructuring of props enhances maintainability.

The getProps function is used to dynamically obtain properties, and the props object is restructured for better clarity.


16-23: LGTM! Export default object is well-structured.

The export default object includes all necessary properties, and the description is updated to include a link to the documentation.


25-46: LGTM! run method is well-implemented.

The run method handles filePathOrContent appropriately and ensures accurate attachment creation.

components/salesforce_rest_api/common/sobjects/campaign.mjs (3)

1-1: LGTM! Import statement is appropriate.

The import of commonProps from props-async-options.mjs is necessary for the functionality described.


4-48: LGTM! initialProps object is well-structured.

The initialProps object includes detailed descriptions and constraints for each property, enhancing clarity and usability.


50-127: LGTM! extraProps object is well-structured.

The extraProps object includes detailed descriptions and constraints for each property, enhancing clarity and usability.

components/salesforce_rest_api/common/sobjects/opportunity.mjs (4)

1-3: LGTM! Import statements are appropriate.

The imports of RECORD_SOURCE_OPTIONS, commonProps, and salesforce are necessary for the functionality described.


6-20: LGTM! createProps object is well-structured.

The createProps object includes detailed descriptions and constraints for the ContactId property, enhancing clarity and usability.


22-57: LGTM! initialProps object is well-structured.

The initialProps object includes detailed descriptions and constraints for each property, enhancing clarity and usability.


59-151: LGTM! extraProps object is well-structured.

The extraProps object includes detailed descriptions and constraints for each property, enhancing clarity and usability.

components/salesforce_rest_api/common/sobjects/case.mjs (1)

5-35: Ensure Consistency in Property Descriptions

The properties in initialProps are well-defined. Ensure that the descriptions and labels are consistent with Salesforce's API documentation.

components/salesforce_rest_api/common/sobjects/contact.mjs (2)

7-36: Ensure Consistency in Property Descriptions

The properties in initialProps are well-defined. Ensure that the descriptions and labels are consistent with Salesforce's API documentation.


39-209: Ensure Correctness of Common Property Imports

The properties in extraProps are well-defined and make use of commonProps. Verify that the imported properties are correctly defined in commonProps.

Verification successful

Common Property Imports Verified

The common properties (AccountId, IndividualId, UserId, RecordTypeId, ContactId) are correctly imported and defined in the components/salesforce_rest_api/common/props-async-options.mjs file.

  • components/salesforce_rest_api/common/props-async-options.mjs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of common property imports.

# Test: Search for the definitions of common properties in the `commonProps` file. Expect: Correct definitions.
rg --type javascript 'AccountId|IndividualId|UserId|RecordTypeId|ContactId' components/salesforce_rest_api/common/props-async-options.mjs

Length of output: 174


Script:

#!/bin/bash
# Description: Verify the correctness of common property imports.

# Test: Search for the definitions of common properties in the `commonProps` file. Expect: Correct definitions.
rg --type js 'AccountId|IndividualId|UserId|RecordTypeId|ContactId' components/salesforce_rest_api/common/props-async-options.mjs

Length of output: 209

components/salesforce_rest_api/common/sobjects/task.mjs (3)

53-75: Ensure Consistency in Property Descriptions

The properties in initialProps are well-defined. Ensure that the descriptions and labels are consistent with Salesforce's API documentation.


78-244: Ensure Correctness of Common Property Imports

The properties in extraProps are well-defined and make use of commonProps. Verify that the imported properties are correctly defined in commonProps.

Verification successful

Common Property Imports Verified

The properties UserId and ContactOrLeadIds are correctly defined in the commonProps file.

  • components/salesforce_rest_api/common/props-async-options.mjs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of common property imports.

# Test: Search for the definitions of common properties in the `commonProps` file. Expect: Correct definitions.
rg --type javascript 'UserId|ContactOrLeadIds' components/salesforce_rest_api/common/props-async-options.mjs

Length of output: 145


Script:

#!/bin/bash
# Description: Verify the correctness of common property imports.

# Test: Search for the definitions of common properties in the `commonProps` file. Expect: Correct definitions.
rg 'UserId|ContactOrLeadIds' components/salesforce_rest_api/common/props-async-options.mjs

Length of output: 126


11-50: Ensure Consistency in Property Descriptions

The properties in createProps are well-defined. Ensure that the descriptions and labels are consistent with Salesforce's API documentation.

components/salesforce_rest_api/common/sobjects/event.mjs (26)

28-33: LGTM!

The property ActivityDate is correctly defined with appropriate labels and descriptions.


34-39: LGTM!

The property Description is correctly defined with appropriate labels and descriptions.


40-45: LGTM!

The property DurationInMinutes is correctly defined with appropriate labels and descriptions.


46-51: LGTM!

The property EndDateTime is correctly defined with appropriate labels and descriptions.


52-57: LGTM!

The property IsAllDayEvent is correctly defined with appropriate labels and descriptions.


58-63: LGTM!

The property Location is correctly defined with appropriate labels and descriptions.


66-71: LGTM!

The property DeclinedEventInviteeIds is correctly defined with appropriate labels and descriptions.


72-77: LGTM!

The property UndecidedEventInviteeIds is correctly defined with appropriate labels and descriptions.


78-83: LGTM!

The property OwnerId is correctly defined with appropriate labels and descriptions.


84-90: LGTM!

The property IsPrivate is correctly defined with appropriate labels and descriptions.


91-97: LGTM!

The property IsRecurrence is correctly defined with appropriate labels and descriptions.


98-103: LGTM!

The property IsReminderSet is correctly defined with appropriate labels and descriptions.


104-110: LGTM!

The property IsVisibleInSelfService is correctly defined with appropriate labels and descriptions.


111-116: LGTM!

The property RecurrenceDayOfMonth is correctly defined with appropriate labels and descriptions.


117-123: LGTM!

The property RecurrenceDayOfWeekMask is correctly defined with appropriate labels, descriptions, and options.


124-129: LGTM!

The property RecurrenceEndDateOnly is correctly defined with appropriate labels and descriptions.


130-136: LGTM!

The property RecurrenceInstance is correctly defined with appropriate labels, descriptions, and options.


138-144: LGTM!

The property RecurrenceInterval is correctly defined with appropriate labels and descriptions.


145-151: LGTM!

The property RecurrenceMonthOfYear is correctly defined with appropriate labels, descriptions, and options.


153-159: LGTM!

The property RecurrenceStartDateTime is correctly defined with appropriate labels and descriptions.


160-166: LGTM!

The property RecurrenceTimeZoneSidKey is correctly defined with appropriate labels, descriptions, and options.


167-173: LGTM!

The property RecurrenceType is correctly defined with appropriate labels, descriptions, and options.


175-180: LGTM!

The property ReminderDateTime is correctly defined with appropriate labels and descriptions.


181-200: LGTM!

The property ShowAs is correctly defined with appropriate labels, descriptions, and options.


202-207: LGTM!

The property StartDateTime is correctly defined with appropriate labels and descriptions.


208-219: LGTM!

The property Subject is correctly defined with appropriate labels, descriptions, and options.

components/salesforce_rest_api/common/sobjects/lead.mjs (3)

7-13: LGTM! The createProps section is well-defined.

The IsConverted property is well-documented and follows best practices.


15-49: LGTM! The initialProps section is well-defined.

The properties are well-documented and follow best practices.


Line range hint 51-361: LGTM! The extraProps section is well-defined.

The properties are well-documented and follow best practices.

components/salesforce_rest_api/common/sobjects/account.mjs (4)

7-12: LGTM! The createProps section is well-defined.

The Name property is well-documented and follows best practices.


14-21: LGTM! The updateProps section is well-defined.

The IsPartner property is well-documented and follows best practices.


23-48: LGTM! The initialProps section is well-defined.

The properties are well-documented and follow best practices.


50-361: LGTM! The extraProps section is well-defined.

The properties are well-documented and follow best practices.

@GTFalcao
Copy link
Collaborator Author

GTFalcao commented Aug 2, 2024

  • Fixed error in base64 parsing of attachment files;
  • Changed Case OwnerId from Contact to User (the documentation explicitly says Contact, but apparently the API expects a User);
  • Fixed "User Role ID" selecting wrong records;
  • Removed "IsPublished" from CaseComment's props;
  • Removed "IsPartner" from Account's props;
  • Fixed "Update Opportunity" summary;
  • The error in "Create Task" is a business rule error (of props incompatible with each other). The "Recurring" prop probably needs to be true for "Recurrence Time Zone" to be used, among others. I had other business rule errors too with other props, I believe this is something users will not face as much as these rules probably make more sense in real world scenarios than in testing. This was my prop setup for a successful run, tweaking props from your inputs:
IsRecurrence: true
TaskSubtype: Email
Description: Task from Pipedream 1432
Priority: Normal
CallDisposition: we'll call back
CallDurationInSeconds: 30
CallObject: Test caller
CallType: Inbound
IsReminderSet: true
RecurrenceDayOfWeekMask: [ 2, 4, 16, 8 ]
RecurrenceEndDateOnly: 2024-08-09
RecurrenceStartDateOnly: 2024-08-05
RecurrenceTimeZoneSidKey: Asia/Bangkok
RecurrenceType: RecursEveryWeekday
ReminderDateTime: 2024-08-10
Status: Completed
Subject: Send Letter

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f02fbbb and 390491c.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (6)
  • components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/account.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/case.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/caseComment.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/task.mjs (1 hunks)
  • components/salesforce_rest_api/common/sobjects/user.mjs (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • components/salesforce_rest_api/common/sobjects/case.mjs
  • components/salesforce_rest_api/common/sobjects/user.mjs
Additional comments not posted (14)
components/salesforce_rest_api/common/sobjects/caseComment.mjs (3)

5-10: LGTM!

The CommentBody property is correctly defined.


11-22: LGTM!

The ParentId property is correctly defined.


23-29: LGTM!

The IsPublished property is correctly defined.

components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs (5)

1-3: LGTM!

The import statements are correctly defined.


5-12: LGTM!

The getProps function is correctly used.


13-29: LGTM!

The exported object is correctly defined.


30-44: LGTM!

The props object is correctly defined.


45-74: LGTM!

The run method is correctly defined.

components/salesforce_rest_api/common/sobjects/task.mjs (3)

11-50: LGTM!

The createProps section is correctly defined.


52-75: LGTM!

The initialProps section is correctly defined.


77-244: LGTM!

The extraProps section is correctly defined.

components/salesforce_rest_api/common/sobjects/account.mjs (3)

7-12: LGTM!

The Name property in createProps is well-defined and clear.


14-39: LGTM!

The properties in initialProps are well-defined and clear.


41-352: LGTM!

The properties in extraProps are well-defined and comprehensive.

@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/Salesforce-usability-improvements-12697-b40ce55ccd914d1fbfd958dab1288dc9

@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test report
https://vunguyenhung.notion.site/Salesforce-usability-improvements-12697-b40ce55ccd914d1fbfd958dab1288dc9

@GTFalcao
Copy link
Collaborator Author

GTFalcao commented Aug 5, 2024

/approve

@GTFalcao GTFalcao merged commit 54b92af into master Aug 5, 2024
10 checks passed
@GTFalcao GTFalcao deleted the salesforce-usability-improvements branch August 5, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged For maintainers: This issue has been triaged by a Pipedream employee
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants