Resources

Renesas IoT Sandbox Documentation

Salesforce Library

These functions provide access to your Salesforce account. To be able to use this library, you MUST connect your Salesforce account to your Renesas IoT Sandbox account. After doing this, a ticket is sent to Renesas IoT Sandbox whenever a case is created in Salesforce. Device data is gathered and posted back to the Salesforce’s case automatically.

Follow this tutorial to learn how to connect your accounts.


Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import Salesforce


Functions


Salesforce.create_case

Usage: Salesforce.create_case(status=None, priority=None, subject=None, description=None, other=None)

Creates a new case in your connected Salesforce account.

  • Credit cost: 1
  • Parameters:
    • status: str 'New', 'Working', or 'Escalated'. If not specified, default is 'New'
    • priority: str 'High', 'Medium', or 'Low'. If not specified, default is 'Medium'
    • subject: str subject of the case
    • description: str description of the case
    • other: str other comments
  • Returns: dict info of new case created:
    {u'success': True, u'id': u'50046000000nPEpAAM', u'errors': []}



Salesforce.comment_case

Usage: Salesforce.comment_case(case_id, text, internal=False)

Leaves a text comment on the specified case.

  • Credit cost: 1
  • Parameters:
    • case_id: str case_id given in Salesforce. (ex. '50046000000nPEpAAM')
    • text: str text to leave in the comment
    • internal: bool indicates whether or not the comment is public
  • Returns: dict info of the comment posted:
    {u'relativeCreatedDate': u'Just Now', u'parent': {u'type': u'Case', u'url': u'/services/data/v38.0/chatter/records/50046000000nPFdAAM', u'mySubscription': None, u'name': u'00001043', u'id': u'50046000000nPFdAAM', u'motif': {u'mediumIconUrl': u'/img/icon/cases32.png', u'color': u'F2CF5B', u'largeIconUrl': u'/img/icon/cases64.png', u'smallIconUrl': u'/img/icon/cases16.png', u'svgIconUrl': None}}, u'capabilities': {u'comments': {u'page': {u'currentPageToken': None, u'nextPageUrl': None, u'currentPageUrl': u'/services/data/v38.0/chatter/feed-elements/0D546000002442ZCAQ/capabilities/comments/items', u'total': 0, u'nextPageToken': None, u'items': []}}, u'edit': {u'isEditableByMeUrl': u'/services/data/v38.0/chatter/feed-elements/0D546000002442ZCAQ/capabilities/edit/is-editable-by-me', u'lastEditedBy': None, u'relativeLastEditedDate': None, u'isEditRestricted': False, u'lastEditedDate': None, u'latestRevision': 1}, u'topics': {u'canAssignTopics': True, u'items': []}, u'mute': {u'isMutedByMe': False}, u'chatterLikes': {u'myLike': None, u'likesMessage': None, u'isLikedByCurrentUser': False, u'page': {u'currentPageToken': 0, u'nextPageUrl': None, u'previousPageToken': None, u'currentPageUrl': u'/services/data/v38.0/chatter/feed-elements/0D546000002442ZCAQ/capabilities/chatter-likes/items', u'total': 0, u'previousPageUrl': None, u'nextPageToken': None, u'items': []}}, u'interactions': {u'count': 0}, u'bookmarks': {u'isBookmarkedByCurrentUser': False}, u'associatedActions': {u'platformActionGroups': []}, u'status': {u'isApprovableByMe': True, u'feedEntityStatus': u'Published'}}, u'visibility': u'InternalUsers', u'canShare': False, u'clientInfo': {u'applicationUrl': None, u'applicationName': u'M1_SF'}, u'body': {u'isRichText': False, u'messageSegments': [{u'type': u'Text', u'text': u'Comment from Renesas IoT Sandbox'}], u'text': u'Comment from Renesas IoT Sandbox'}, u'type': u'TextPost', u'originalFeedItemActor': None, u'url': u'/services/data/v38.0/chatter/feed-elements/0D546000002442ZCAQ', u'feedElementType': u'FeedItem', u'actor': {u'isInThisCommunity': True, u'lastName': u'Kha', u'displayName': u'Name', u'companyName': u'Medium One', u'photo': {u'smallPhotoUrl': u'https://c.na40.content.force.com/profilephoto/005/T', u'url': u'/services/data/v38.0/connect/user-profiles/00546000000hLUKAA2/photo', u'fullEmailPhotoUrl': u'https://na40.salesforce.com/img/userprofile/default_profile_200_v2.png?fromEmail=1', u'photoVersionId': None, u'largePhotoUrl': u'https://c.na40.content.force.com/profilephoto/005/F', u'mediumPhotoUrl': u'https://c.na40.content.force.com/profilephoto/005/M', u'standardEmailPhotoUrl': u'https://na40.salesforce.com/img/userprofile/default_profile_45_v2.png?fromEmail=1'}, u'reputation': None, u'isActive': True, u'title': None, u'type': u'User', u'additionalLabel': None, u'url': u'/services/data/v38.0/chatter/users/00546000000hLUKAA2', u'firstName': u'Name', u'communityNickname': u'Name', u'mySubscription': None, u'name': u'Name', u'id': u'00546000000hLUKAA2', u'motif': {u'mediumIconUrl': u'/img/icon/profile32.png', u'color': u'65CAE4', u'largeIconUrl': u'/img/icon/profile64.png', u'smallIconUrl': u'/img/icon/profile16.png', u'svgIconUrl': None}, u'userType': u'Internal'}, u'photoUrl': u'https://c.na40.content.force.com/profilephoto/005/T', u'createdDate': u'2017-03-09T22:12:39.000Z', u'modifiedDate': u'2017-03-09T22:12:39.000Z', u'header': {u'isRichText': None, u'messageSegments': [{u'type': u'EntityLink', u'reference': {u'url': u'/services/data/v38.0/chatter/records/50046000000nPFdAAM', u'id': u'50046000000nPFdAAM'}, u'motif': {u'mediumIconUrl': u'/img/icon/cases32.png', u'color': u'F2CF5B', u'largeIconUrl': u'/img/icon/cases64.png', u'smallIconUrl': u'/img/icon/cases16.png', u'svgIconUrl': None}, u'text': u'00001043'}, {u'type': u'Text', u'text': u' \\u2014 '}, {u'type': u'EntityLink', u'reference': {u'url': u'/services/data/v38.0/chatter/users/00546000000hLUKAA2', u'id': u'00546000000hLUKAA2'}, u'motif': {u'mediumIconUrl': u'/img/icon/profile32.png', u'color': u'65CAE4', u'largeIconUrl': u'/img/icon/profile64.png', u'smallIconUrl': u'/img/icon/profile16.png', u'svgIconUrl': None}, u'text': u'Name'}], u'text': u'00001043 \\u2014 Name'}, u'id': u'0D546000002442ZCAQ', u'event': False, u'isDeleteRestricted': False, u'originalFeedItem': None}
    ",



Salesforce.get_case

Usage: Salesforce.get_case(case_id)

Returns the information of the specified case.

  • Credit cost: 1
  • Parameters:

    • case_id: str case_id given in Salesforce. (ex. '50046000000nPEpAAM')
  • Returns: dict profile of the case:
    {u'Origin': None, u'PotentialLiability__c': None, u'LastModifiedDate': u'2017-03-09T21:57:59.000+0000', u'AccountId': None, u'Description': None, u'SuppliedCompany': None, u'ContactId': None, u'IsClosed': False, u'Reason': None, u'SuppliedEmail': None, u'SuppliedName': None, u'OwnerId': u'00546000000hLUKAA2', u'CreatedById': u'00546000000hLUKAA2', u'SuppliedPhone': None, u'CaseNumber': u'00001042', u'Product__c': None, u'Status': u'New', u'ParentId': None, u'IsDeleted': False, u'Priority': u'Medium', u'Subject': None, u'SystemModstamp': u'2017-03-09T21:57:59.000+0000', u'Type': None, u'IsEscalated': False, u'SLAViolation__c': None, u'CreatedDate': u'2017-03-09T21:57:59.000+0000', u'EngineeringReqNumber__c': None, u'attributes': {u'type': u'Case', u'url': u'/services/data/v20.0/sobjects/Case/50046000000nPFJAA2'}, u'Id': u'50046000000nPFJAA2', u'ClosedDate': None, u'AssetId': None, u'LastModifiedById': u'00546000000hLUKAA2'}
    ",



Sample Code


#Creates a Salesforce case and leaves a comment
import Salesforce

case = Salesforce.create_case()
salesforce_id = case['id']

salesforce_update = "Comment from Renesas IoT Sandbox"
comment = Salesforce.comment_case(salesforce_id,salesforce_update)

Getting Started
User Roles & Permissions
Streams, Tags, & Data Types
Dashboard Widgets
API
Workflow Studio
Workflow Libraries
Metering
Special Characters
Third Party Integration
Mobile
API Explorer

Salesforce Library

These functions provide access to your Salesforce account. To be able to use this library, you MUST connect your Salesforce account to your Renesas IoT Sandbox account. After doing this, a ticket is sent to Renesas IoT Sandbox whenever a case is created in Salesforce. Device data is gathered and posted back to the Salesforce’s case automatically.

Follow this tutorial to learn how to connect your accounts.


Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import Salesforce


Functions


Salesforce.create_case

Usage: Salesforce.create_case(status=None, priority=None, subject=None, description=None, other=None)

Creates a new case in your connected Salesforce account.

  • Credit cost: 1
  • Parameters:
    • status: str 'New', 'Working', or 'Escalated'. If not specified, default is 'New'
    • priority: str 'High', 'Medium', or 'Low'. If not specified, default is 'Medium'
    • subject: str subject of the case
    • description: str description of the case
    • other: str other comments
  • Returns: dict info of new case created:
    {u'success': True, u'id': u'50046000000nPEpAAM', u'errors': []}



Salesforce.comment_case

Usage: Salesforce.comment_case(case_id, text, internal=False)

Leaves a text comment on the specified case.

  • Credit cost: 1
  • Parameters:
    • case_id: str case_id given in Salesforce. (ex. '50046000000nPEpAAM')
    • text: str text to leave in the comment
    • internal: bool indicates whether or not the comment is public
  • Returns: dict info of the comment posted:
    {u'relativeCreatedDate': u'Just Now', u'parent': {u'type': u'Case', u'url': u'/services/data/v38.0/chatter/records/50046000000nPFdAAM', u'mySubscription': None, u'name': u'00001043', u'id': u'50046000000nPFdAAM', u'motif': {u'mediumIconUrl': u'/img/icon/cases32.png', u'color': u'F2CF5B', u'largeIconUrl': u'/img/icon/cases64.png', u'smallIconUrl': u'/img/icon/cases16.png', u'svgIconUrl': None}}, u'capabilities': {u'comments': {u'page': {u'currentPageToken': None, u'nextPageUrl': None, u'currentPageUrl': u'/services/data/v38.0/chatter/feed-elements/0D546000002442ZCAQ/capabilities/comments/items', u'total': 0, u'nextPageToken': None, u'items': []}}, u'edit': {u'isEditableByMeUrl': u'/services/data/v38.0/chatter/feed-elements/0D546000002442ZCAQ/capabilities/edit/is-editable-by-me', u'lastEditedBy': None, u'relativeLastEditedDate': None, u'isEditRestricted': False, u'lastEditedDate': None, u'latestRevision': 1}, u'topics': {u'canAssignTopics': True, u'items': []}, u'mute': {u'isMutedByMe': False}, u'chatterLikes': {u'myLike': None, u'likesMessage': None, u'isLikedByCurrentUser': False, u'page': {u'currentPageToken': 0, u'nextPageUrl': None, u'previousPageToken': None, u'currentPageUrl': u'/services/data/v38.0/chatter/feed-elements/0D546000002442ZCAQ/capabilities/chatter-likes/items', u'total': 0, u'previousPageUrl': None, u'nextPageToken': None, u'items': []}}, u'interactions': {u'count': 0}, u'bookmarks': {u'isBookmarkedByCurrentUser': False}, u'associatedActions': {u'platformActionGroups': []}, u'status': {u'isApprovableByMe': True, u'feedEntityStatus': u'Published'}}, u'visibility': u'InternalUsers', u'canShare': False, u'clientInfo': {u'applicationUrl': None, u'applicationName': u'M1_SF'}, u'body': {u'isRichText': False, u'messageSegments': [{u'type': u'Text', u'text': u'Comment from Renesas IoT Sandbox'}], u'text': u'Comment from Renesas IoT Sandbox'}, u'type': u'TextPost', u'originalFeedItemActor': None, u'url': u'/services/data/v38.0/chatter/feed-elements/0D546000002442ZCAQ', u'feedElementType': u'FeedItem', u'actor': {u'isInThisCommunity': True, u'lastName': u'Kha', u'displayName': u'Name', u'companyName': u'Medium One', u'photo': {u'smallPhotoUrl': u'https://c.na40.content.force.com/profilephoto/005/T', u'url': u'/services/data/v38.0/connect/user-profiles/00546000000hLUKAA2/photo', u'fullEmailPhotoUrl': u'https://na40.salesforce.com/img/userprofile/default_profile_200_v2.png?fromEmail=1', u'photoVersionId': None, u'largePhotoUrl': u'https://c.na40.content.force.com/profilephoto/005/F', u'mediumPhotoUrl': u'https://c.na40.content.force.com/profilephoto/005/M', u'standardEmailPhotoUrl': u'https://na40.salesforce.com/img/userprofile/default_profile_45_v2.png?fromEmail=1'}, u'reputation': None, u'isActive': True, u'title': None, u'type': u'User', u'additionalLabel': None, u'url': u'/services/data/v38.0/chatter/users/00546000000hLUKAA2', u'firstName': u'Name', u'communityNickname': u'Name', u'mySubscription': None, u'name': u'Name', u'id': u'00546000000hLUKAA2', u'motif': {u'mediumIconUrl': u'/img/icon/profile32.png', u'color': u'65CAE4', u'largeIconUrl': u'/img/icon/profile64.png', u'smallIconUrl': u'/img/icon/profile16.png', u'svgIconUrl': None}, u'userType': u'Internal'}, u'photoUrl': u'https://c.na40.content.force.com/profilephoto/005/T', u'createdDate': u'2017-03-09T22:12:39.000Z', u'modifiedDate': u'2017-03-09T22:12:39.000Z', u'header': {u'isRichText': None, u'messageSegments': [{u'type': u'EntityLink', u'reference': {u'url': u'/services/data/v38.0/chatter/records/50046000000nPFdAAM', u'id': u'50046000000nPFdAAM'}, u'motif': {u'mediumIconUrl': u'/img/icon/cases32.png', u'color': u'F2CF5B', u'largeIconUrl': u'/img/icon/cases64.png', u'smallIconUrl': u'/img/icon/cases16.png', u'svgIconUrl': None}, u'text': u'00001043'}, {u'type': u'Text', u'text': u' \\u2014 '}, {u'type': u'EntityLink', u'reference': {u'url': u'/services/data/v38.0/chatter/users/00546000000hLUKAA2', u'id': u'00546000000hLUKAA2'}, u'motif': {u'mediumIconUrl': u'/img/icon/profile32.png', u'color': u'65CAE4', u'largeIconUrl': u'/img/icon/profile64.png', u'smallIconUrl': u'/img/icon/profile16.png', u'svgIconUrl': None}, u'text': u'Name'}], u'text': u'00001043 \\u2014 Name'}, u'id': u'0D546000002442ZCAQ', u'event': False, u'isDeleteRestricted': False, u'originalFeedItem': None}
    ",



Salesforce.get_case

Usage: Salesforce.get_case(case_id)

Returns the information of the specified case.

  • Credit cost: 1
  • Parameters:

    • case_id: str case_id given in Salesforce. (ex. '50046000000nPEpAAM')
  • Returns: dict profile of the case:
    {u'Origin': None, u'PotentialLiability__c': None, u'LastModifiedDate': u'2017-03-09T21:57:59.000+0000', u'AccountId': None, u'Description': None, u'SuppliedCompany': None, u'ContactId': None, u'IsClosed': False, u'Reason': None, u'SuppliedEmail': None, u'SuppliedName': None, u'OwnerId': u'00546000000hLUKAA2', u'CreatedById': u'00546000000hLUKAA2', u'SuppliedPhone': None, u'CaseNumber': u'00001042', u'Product__c': None, u'Status': u'New', u'ParentId': None, u'IsDeleted': False, u'Priority': u'Medium', u'Subject': None, u'SystemModstamp': u'2017-03-09T21:57:59.000+0000', u'Type': None, u'IsEscalated': False, u'SLAViolation__c': None, u'CreatedDate': u'2017-03-09T21:57:59.000+0000', u'EngineeringReqNumber__c': None, u'attributes': {u'type': u'Case', u'url': u'/services/data/v20.0/sobjects/Case/50046000000nPFJAA2'}, u'Id': u'50046000000nPFJAA2', u'ClosedDate': None, u'AssetId': None, u'LastModifiedById': u'00546000000hLUKAA2'}
    ",



Sample Code


#Creates a Salesforce case and leaves a comment
import Salesforce

case = Salesforce.create_case()
salesforce_id = case['id']

salesforce_update = "Comment from Renesas IoT Sandbox"
comment = Salesforce.comment_case(salesforce_id,salesforce_update)