Skip to content

Instantly share code, notes, and snippets.

@ReidCarlberg
Created December 19, 2013 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ReidCarlberg/8045684 to your computer and use it in GitHub Desktop.
Save ReidCarlberg/8045684 to your computer and use it in GitHub Desktop.
The HTML portion of the push topic -- this is where you configure your Client ID, etc.
<!-- Sample html file that corresponds to the 99-sample.js file -->
<!-- This creates and configures the onscreen elements of the node -->
<!-- If you use this as a template, replace IBM Corp. with your own name. -->
<!-- First, the content of the edit dialog is defined. -->
<script type="text/x-red" data-template-name="salesforce in">
<!-- data-template-name identifies the node type this is for -->
<!-- Each of the following divs creates a field in the edit dialog. -->
<!-- Generally, there should be an input for each property of the node. -->
<!-- The for and id attributes identify the corresponding property -->
<!-- (with the 'node-input-' prefix). -->
<!-- The available icon classes are defined in Twitter Bootstrap -->
<div class="form-row">
<label for="node-input-topic"><i class="icon-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="Topic">
</div>
<!-- By convention, most nodes have a 'name' property. The following div -->
<!-- provides the necessary field. -->
<div class="form-row">
<label for="node-input-username"><i class="icon-tag"></i> Username</label>
<input type="text" id="node-input-username" placeholder="Username">
</div>
<div class="form-row">
<label for="node-input-password"><i class="icon-tag"></i> Password</label>
<input type="text" id="node-input-password" placeholder="Password">
</div>
<div class="form-row">
<label for="node-input-token"><i class="icon-tag"></i> Token</label>
<input type="text" id="node-input-token" placeholder="Token">
</div>
<div class="form-row">
<label for="node-input-clientId"><i class="icon-tag"></i> Client Id</label>
<input type="text" id="node-input-clientId" placeholder="Client Id">
</div>
<div class="form-row">
<label for="node-input-clientSecret"><i class="icon-tag"></i> Client Secret</label>
<input type="text" id="node-input-clientSecret" placeholder="Client Secret">
</div>
<div class="form-row">
<label for="node-input-redirectUri"><i class="icon-tag"></i> Redirect URI</label>
<input type="text" id="node-input-redirectUri" placeholder="Redirect URI">
</div>
<div class="form-row">
<label for="node-input-pushTopicName"><i class="icon-tag"></i> Push Topic</label>
<input type="text" id="node-input-pushTopicName" placeholder="Push Topic Name">
</div>
</script>
<!-- Next, some simple help text is provided for the node. -->
<script type="text/x-red" data-help-name="salesforce in">
<!-- data-help-name identifies the node type this help is for -->
<!-- This content appears in the Info sidebar when a node is selected -->
<!-- The first <p> is used as the pop-up tool tip when hovering over a -->
<!-- node in the palette. -->
<p>Simple Salesforce Input Node</p>
<p>Outputs an object called <b>msg</b> containing <b>msg.topic</b> and
<b>msg.payload</b>. <b>msg.payload</b> is an SObject.</p>
</script>
<!-- Finally, the node type is registered along with all of its properties -->
<!-- The example below shows a small subset of the properties that can be set-->
<script type="text/javascript">
RED.nodes.registerType('salesforce in',{
category: 'input', // the palette category
defaults: { // defines the editable properties of the node
name: {value:"SFDCInName"}, // along with default values.
topic: {value:"SFDCInTopic", required:true},
username: {value:"reid@labs.551"},
password: {value:"Dreamforcexxxxx"},
token: {value:"YourTokenHere"},
clientId: {value:"3MVG9y6x0357Hlefg7ne7tiUmhOZad6PLdNH8ljsB0UbY9OTJcx2Qp.c2xUVzXxBCV0xBjuFXYp0Ro4uS1mWV"},
clientSecret: {value:"1909279409156583445"},
redirectUri: {value:"http://localhost:3000/oauth/_callback"},
pushTopicName: {value:"LAB_OutboundSample"}
},
color:"BurlyWood",
inputs:0, // set the number of inputs - only 0 or 1
outputs:1, // set the number of outputs - 0 to n
icon: "arrow-in.png", // set the icon (held in public/icons)
label: function() { // sets the default label contents
return this.name||this.topic||"Salesforce";
},
labelStyle: function() { // sets the class to apply to the label
return this.name?"node_label_italic":"";
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment