These days product data is everywhere. Everyone seems to collect it, have a lot of it, but the question remains; how exactly can you ensure your organization’s product data is being put to good use?

It’s time to take your product development one step further by providing role-based data access, connecting your enterprise systems, and learning how to make the most of your product data. I am going to explain exactly how easy that is to do.

The current state of product data

Companies today have many different roles that require access to product data. This may include people outside of the typical roles of which you may be thinking.

Departments such as engineering, manufacturing, that’s a given, but expand your thinking to include operations, purchasing, and marketing. They all need data access in order to edit and consume information. Think about sourcing…I’ll stop there, but you get the idea.

Let’s focus on the engineering department for a moment.

People could be involved from the mechanical side, the electrical side, or even a quality standpoint. Beyond that, people need to either contribute or consume information that could include manufacturing, service, sales, and more.

Product data game-changers

Product data silos limit productivity – PTC & EAC have the answer.

PTC ThingWorx Navigate was designed to address data accessibility problems by providing simple role-based apps that deliver just the right information to different groups (or departments) in the way that they need

When non-engineering colleagues need access to vital information, they typically interrupt an engineer or designer with a request. ThingWorx Navigate eliminates that distraction and “double-billing.” Through role or task-based self-service applications, data can be securely shared with a team. That way non-expert teams can use a simplified user interface to access the product data they need, right when they need it.

To help accelerate product development processes and take product data even further, our company (EAC Product Development Solutions) has also created what we call EAC Productivity Apps that work alongside ThingWorx Navigate apps.

So what’s the difference between ThingWorx, ThingWorx Navigate and our EAC Productivity apps? 

This is a great question- I am going to try and paint the picture for you. 

First, it’s important that you understand what ThingWorx is and how it is different from ThingWorx Navigate. 

ThingWorx is the proper name of PTC’s Internet of Things (IoT) platform comprised of 5 components; foundation, industrial connectivity, analytics, studio, and utilities. It can basically connect any computer systems or physical assets as long as they have an API port or sensors streaming out data. There are many levels and combinations of each of these components, all serving unique business drivers. Please contact us if you’d like to talk through what you’re trying to do.

The foundation component is the heart of the ThingWorx loT platform used to make connections to ‘things’ which could be machines, products or software systems or pretty much anything with an IP address and a communications interface.

User interfaces to the data coming from these connections are displayed on websites called ‘mashups,’ created with ThingWorx foundation. You might know these perhaps as ‘data mashups’ or possibly as ‘data dashboards’. Simply put, Thingworx is the IoT platform that makes everything possible. (Here’s exactly what makes Thingworx the leading technology for industrial IoT)

Then you have ThingWorx Navigate

ThingWorx Navigate is the proper name of PTC’s applications that run off, or in other words, use the ThingWorx IoT platform.  You can learn more about ThingWorx Navigate by reading this data sheet. ThingWorx Navigate is a pre-packaged set of data interfaces (also known as apps or applications) built on an Assessment and Deployment Kit (ADK). 

ThingWorx Navigate Apps use a Windchill (PLM) connector to extract product data for presentation to Windchill Product Lifecycle Management users.  

ThingWorx Navigate Solution. Thingworx Navigate real based apps for tooling developers, purchasing agents, quality inspectors, processing planners and more.

Fundamentally, ThingWorx Navigate Apps are all simply data and product information mashups created with ThingWorx. With ThingWorx Navigate you receive out-of-the-box apps that are instantly ready to be used with your PLM system. The idea behind these product lifecycle management apps is to ensure users can capture the complete functionality of their PLM (product lifecycle management) investment.

ThingWorx Navigate Apps eliminate user intimidation based on the complexity of PLM platforms like Windchill. They ensure organizations can easily make use of their big data

ThingWorx Navigate Benefits

ThingWorx Navigate PLM Apps include: 

View Design Files – A design file would be a format of a file that isn’t the native CAD format. This could be a staph or Induce or perhaps a 3D PDF 

View Drawing – Allows you to look at just drawings. This application pulls drawings from your Windchill PLM system.

View Part Properties – This feature allows you to look at part properties- as if you were hitting the ‘Information button’ next to a file.

View Parts List – Allows you to look at bills of Materials (BOMs) 

View Part Structure– With the View Part Structure App, ThingWorx is actually going into PDMLink and showing different aspects of a specific part instead of different ways of going at it (such as having to open several different tabs to get information). Using this application, you can get all your information together on one page. This feature also includes capabilities that cross-highlight part structures within your product. For instance, you could select a component and it would highlight that part and create a hyperlink that allows you to directly look at that specific part. This feature essentially creates a mash-up that takes information from different places inside of Windchill PDMLink and brings them together putting them on one screen, allowing you to have all your information at your fingertips.

View Document  & View Document Structure

Download this FREE ThingWorx Navigate eBook

If you would like to learn more about ThingWorx Navigate technology or if you have any questions, you can always request to talk with Thingworx Navigate specialists here.

PLM Applications created by EAC

Our EAC Productivity Apps (also known as product lifecycle applications) are also built on the ThingWorx technology platform.

They allow departments to access content and perform common tasks through a very simple interface, versus having to use a complex product lifecycle management system (PLM) or Enterprise Resource Planning (ERP) system. 

EAC Productivity Apps for Windchill

PTC Navigate Apps vs. EAC Productivity Apps

Our EAC Productivity Apps provide capabilities beyond that of the out of the box ThingWorx Navigate apps. 

In short, ThingWorx Navigate applications allow you to securely access and present role-specific data from your Windchill system. They provide all of the power of a Product Lifecycle Management (PLM) system to someone who is not familiar with its ins-and-outs of product data management. 

EAC Productivity Apps take it a step further by taking the underlying technology of ThingWorx Navigate, and the ability to get at the information in the PLM system and create even more complete applications that really give individuals instantaneous access to the information and product data they need to do their job. EAC’s PLM applications are created using PTC’s ThingWorx IoT platform, however, they can run independently of ThingWorx Navigate. 

These apps are unique to EAC

While built using the same ThingWorx foundation, ADK and [Windchill connector], they have their own look, feel and functionality.  These mashups are packaged and sold together as a collection. EAC Productivity Apps created for Windchill promote user adoption and amplify the return on the investment you’ve made in your Windchill system, as well as extending role-based visibility into relevant product data and the impact PLM has on your organization. 

Take your product data further with EAC Productivity Apps

Every subscription of EAC Productivity Apps includes free access to EAC Productivity Home. EAC Productivity Home is a proprietary framework, or launcher, for ThingWorx Navigate applications.

It sits on top of Windchill and Navigate to provide a fully configurable and responsive interface. Productivity Home simplifies user interaction and helps administrators maintain the user portal after upgrading to new releases of ThingWorx Navigate.

PLM App 'Quick Search'

The EAC Productivity App, Quick Search, provides a simple way for users to find content in Windchill. It removes the need for users to apply an understanding of how Windchill objects are related in order to find the information needed to do their job.

The Quick Search PLM application also allows users to search for components and retrieve information and file formats. For instance, if you were to grab a drive system and do a quick search, it’s going to find product information such as parts, EMP like documents, CAD files and more. See EAC Productivity Application Quick Search in action here.

You can also learn more about the Quick Search features in this brochure.

The Quick Access EAC Productivity Application streamlines access to critical and select data sets. Simplifies downstream users feeding critical quality information back to engineering with minimal effort. 

This EAC Productivity App allows downstream users to feed critical quality information back to engineering with minimal effort. The simplified interface and consolidated task workflows help users easily submit new problem reports, new change requests, and new variances.

Here's an example of what a user might see using the EAC Productivity Application Quick Access
Here’s an example of what a user might see using the EAC Productivity Application Quick Access

For instance, you could select a component (such as a product), pick its name (the end item number), search for it, and you would get straight to assemblies. With the use of Quick Access users can easily submit new problem reports, change requests, variances and more.

You can learn more about Quick Access features in this brochure.

The Part Associations EAC application provides a “shortcut” for non-CAD users to access critical files and documentation associated with designs like drawings, parts, assemblies, and other documents associated with CAD files and part data.

Here’s an example of what a user might see using the EAC Productivity Application ‘Parts Association’

You can learn more about Part Association features in this brochure.

BoM Reports App provides a visual representation of cost roll-up for materials, and detailed informational listing of the items in a Bill of Materials. 

This EAC Productivity App allows users to quickly assess a Bill of Material and ensure projects stay on-time and on-track. The simplified view helps ensure products are built with the appropriate design iterations. With the use of BoM Reports users can easily see BoMs, lists of unreleased parts, parts that have been created or modified by specific users and more.

This app allows users to see the progress of a bill of materials, and apply filters to focus on parts that are not yet released. It is also useful for viewing all of the “make” parts or “buy” parts in a given BoM, or all parts created/modified by a particular user.

Here’s an example of what a user might see using the EAC Productivity Application ‘BoM Reports’

Get better access to your product data 

See all the features of EAC Productivity Apps for PTC Windchill by watching our short webinar below or contact us to start the conversation about how you can get better access to your data with ThingWorx Navigate and EAC Productivity Apps. (Quick Access, BoM Report, Part Associations, Quick Search)

By now, I’m sure you’ve heard the buzz about IoT (the Internet of Things).

‘Start improving the way you do business’, ‘connect with technology’, ‘responsive solutions’, ‘amazing results’.

It’s safe to say that the internet of things along with smart connected enterprises have easily become technology’s theme of the year.

Businesses everywhere have started to look at how they can make more money by inserting this “IoT” thing into their business processes.

The truth behind your success and IoT:

No matter where your journey begins with IoT, it’s essential to recognize good business models rely on technological processes, but technology on its own is not enough.

When it comes to IoT and connected business model innovations, if you don’t have a solid business case, you’re not going to have success.

A connected strategy is about business and business transformation. It’s not just about the technology, it’s about using technology as an enabler.

It’s important to realize there is no value in your IoT platform alone. The real value for you, the success of your business case, lies within your application.

The future is smart and connected. 

Whether you choose to build connected solutions into existing products, enter new markets, change your business model, or connect your manufacturing floor; you need to be ready.

Transforming the way you connect with your products, organization, and customers all starts with smart connected design and the right Internet of Things (IoT) platform. The right platform allows you to connect and scale your business.

This is exactly what our company specializes in, in fact we have even created a dedicated connect services team to design and implement custom connected strategies for any organization.

Being able to monitor a product from design into manufacturing, throughout its complete lifecycle makes it possible to improve product quality, increase production, reduce costs, and even predict failures. 

Building a smart connected strategy that works for you:

Integrating company initiatives with the Internet of Things needs a strategy, this is what we are here for.

Our connect services team works with your organization to deliver workshops, prescribe technology solutions, and create an IoT strategy that coincides with your company initiatives.

We want to help you define a strategy that makes a connection between your products and operations that already exist within your company and the smart, connected world that we live in today.

We tend to operate our businesses like we’re playing a game of telephone…and it’s costing us all money.
You don’t have to be a genius to know that within many companies’ sales, marketing, and R&D teams serve separate functions. With different goals, targets and initiatives these teams tend to collaborate among themselves using the same system of record.

For example, within the same company, a department may rely on Product Lifecycle Management (PLM) systems while others may depend on Enterprise Resource Planning (ERP), Manufacturing Execution System data (MES), and Quality Management Systems (QMS).

Marketing, Management, Purchasing, Engineering, Technical Publications and manufacturing all need to operate off product designs and Bill of Materials (BOM), but while doing so people are likely to interrupt engineering to get information.

With this information they ask different questions, have different intentions, and speak different departmental languages.

The reality is; this inaccessible data is about the same product that happens to be housed in a system you can’t normally access.

By resorting to these misaligned processes, we end up operating on data without its entire context, therefore we lose productivity to requests for data and the switching costs of changing tasks.

Besides, these interruptions are generally counterproductive, especially when you’re working on one task and you’re interrupted regarding a completely different topic.

Without a single means to bridge these systems, your company is missing out on valuable information, time savings, and productivity.

We live in a world where siloed departmental communication doesn’t need to be the norm, after all technology is just about everywhere!

By integrating your critical data into a centralized location, your organization will increase visibility, and achieve better, more informed business decisions.

With technology that exists today, your separate departments can pull data from multiple systems into easy role-based dashboards, providing greater visibility and enhanced analysis.

The result is a rapid way for your team to get data from the vast data pool within your organization, and access it in an easy to consume space.

One of the ways we transform the way companies design, manufacture, connect, and service their products is by value stream mapping ‘Product Development Systems’ and looking for ways to ensure people have access to the information they need when they need it.

Tools like Thingworx Navigate, for companies invested in PTC’s Windchill solution, or the standard Thingworx platform and PLM Apps for those that aren’t, are helping companies pull information from different departments, systems, vendors, etc. to make sure every role has a simplified view of the information they need, when they need it, without slowing down any other departments.

Remember in 1977 when Ken Olson, the founder of Digital Equipment Corporation said, “there is no reason anyone would want a computer in their home”? Boy was he wrong. Not even a leader in the technology industry could predict how quickly our usage of technology would change.

If you don’t make an effort to keep up with the fast pace of technology; you will fall behind. It’s critical that you proactively embrace and move towards digital processes to ensure that future products better meet the needs of customers.  

What better way to keep up with the future than making highly accurate product performance and behavior predictions with the right design tools? 

PTC developed a Creo extension called Creo Product Insight. It lets designers and engineers incorporate the latest sensor technology into their designs.

What is Creo Product Insight?

Creo Product Insight captures and analyzes product data from live sensors on prototypes and products directly within your CAD model. This tool produces a digital twin, an exact replica of a physical prototype in a virtual CAD model, to mirror the performance of a product under real-world conditions.  

How does it work? You add digital sensors from a library directly into your CAD models in Creo. Then you connect them to the data streams from physical products. Whether you’re looking to get more value out of your prototypes, design smart connected products, or use data to improve the quality of existing products, the Creo Product Insight Extension allows you to design smarter. 

So how are organizations keeping up with the digital transformation with the Creo Product Insight Extension?

Improving New Product Design

When you’re improving new product design you’re most likely basing your design decision on assumptions and historical data. This puts you in a difficult spot because you may not have up-to-date-information which may cause inaccurate solutions and error-prone results. 

Creo Product Insight Extension | EAC Product Development Solutions
Sensor data from CAD model shown in picture above

Creo Product Insight allows you to validate design assumptions using real-world data from the field directly in Creo’s simulation and analysis tools. Using this extension also decreases your reliance on building prototypes because it gives you live product performance and behavior. 

Improving Existing and Next-Generation Product Designs 

The absence of real-world product data stunts the optimization of current and future products. If you had access to real-world data, you would be able to validate design criteria against customer usage data and mitigate risk of product failure, warranty, repair, and liability. 

With Creo Product Insight and ThingWorx you can analyze field data and provide meaningful information back to engineering. Using real-world data allows you to identify opportunities for new products in the market and understand over and under engineered designs to reduce product life cycle costs. 

Improving Smart Connected Product Design 

The lack of specialized tools that support smart connected products puts you at risk of falling behind the digital transformation process. When sensors and a strategy to capture real-live data are disconnected from your design process there is no way to deliver the value that your customers deserve out of their products.  

Creo Product Insight gives you the ability to optimize sensor replacements, choose a sensor type, and validate data capture requirement during the design process. The extension creates an integrated design process that delivers optimal value from smart connected products.  

Creo Product Insight Digital Twin | EAC Product Development Solutions
Digital Twins bring value to design engineers by showing one twin’s real-world data synced into its other twin’s CAD model datatracking product performance along the way

Creo Product Insight Capabilities and Benefits

Capabilities:

  • Reuse and instrument released designs
  • Embed sensors into new designs
  • Connect CAD models via digital twins to real-world data
  • Use real-world sensor data in CAD design
  • Integration with ThingWorx, the world’s leading industrial IoT platform
  • Prepare for Product as a Service

Benefits

  • Eliminate manual workflows to use real-world sensor data in design
  • Optimize products to real-world conditions
  • Ensure that future products better meet the needs of customers
  • Creo analyses outside of the design office
  • Decrease reliance on physical prototyping

Creo Product Insight Licensing and Creo Version Capabilities

The Creo Product Insight is an add-on extension that is available for subscription licensing only. You do not need ThingWorx to use this extension – although using ThingWorx with it will fully optimize your results.

“Physical” Sensors – Creo 4 (M020):

  • Easily define and place ‘measure’ sensors by adding physical sensors to Creo Assemblies
  • New Instrumented sub-type to protect reused/released design data
  • Associated parameter and input definitions and associated calculations
  • Define (physical) calculating sensors (M020) to report analysis results (center of gravity, mass, area, etc.)

UX Sensors – Creo 4 (M030 & M040):

  • Connection to ThingWorx to support reporting analyses results (M040)
  • Run Creo analysis using Behavioral Modeling, Simulation, and Mechanism Dynamics (M040)
  • Read real-world data from ThingWorx (or CSV data file) and use input variables to run analyses and report results back to data tables

“Virtual” Sensors – Creo 4 (M050):

  • Specialized Virtual sensor handling – (excluded from BOM, meshing, and graphics)
  • Directly connect and read sensor data from file or ThingWorx
  • Use real-world sensor data to drive simulations
  • Creo as a Service from ThingWorx (M050)
  • Save/Export analysis results together with input values back to data file

Get live data from CAD models

Download the Creo Product Insight datasheet or watch this webinar replay to learn more and see if your organization could benefit from collecting live data directly within your CAD models. I’m willing to bet it can.

It’s no wonder people like you are researching ways to reduce downtime. A 2016 ITIC survey found 98% of organizations said a single hour of downtime cost over $100,000. 81% of respondents said an hour of downtime cost their organization over $300,000!

Remote monitoring, remote diagnostics, and predictive analytics are helping organizations reduce downtime. They’re transforming the way companies manage and service their manufacturing operations. As Gary Wollenhaupt calls out in his article about how IoT Slashes Downtime with Predictive Maintenance; manufacturing machinery and other assets can now be connected to the industrial internet of things. Predictive maintenance will begin to replace scheduled maintenance based on mileage, time, usage, or other predictive measures.

We now have the ability to digitally peer into the inner workings of an asset to understand performance, tolerance, temperature, or any number of other factors that can be measured using sensors and device networks. When harnessed, this data is the is the answer to the question being asked by many organizations – “How do I reduce downtime and increase productivity?”

There are many tools on the market to collect the data streaming from sensors and turn it into useful information. We recommend PTC’s suite of industrial connectivity / Industrie 4.0 solutions. We’re not alone. Forrester Researched named PTC and IoT Software Platform Leader and PTC’s ThingWorx was named a leader in “IDC MarketScape: Worldwide IoT Platforms (Software Vendors) 2017 Vendor Assessment.” PTC’s integrated solution suite includes ThingWorx, Vuforia, Kepware, and others.

Our team of solution architects and technical experts can help define and implement the solution(s) you need. We want to help you begin remotely monitoring your assets, whether manufacturing or remotely deployed (products), and leverage predictive analytics to reduce downtime and save money. It may involve a custom solution set, or it could simply be PTC’s eacy-to-deply Manufacturing Apps.

EAC is here to take on as much or as little of your project as necessary. We can simply provide the software for your own team to implement. Or we can manage the entire process from installation, to implementation, to integration and front-end development.

Please contact us. We want to help you leverage technology to reduce downtime and improve your bottom line.


Here is a better description of the solutions mentioned above:

The ThingWorx platform includes compatible modules that deliver the functionality, flexibility, and agility enterprises need to implement industrial IoT apps and AR Experiences. This includes industrial connectivity, analytics, and application enablement. ThingWorx is unrivaled in its ability to help companies quickly connect data streams and publish dashboards or mashups.

Kepware is a single solution for collecting, aggregating, and providing secure access to industrial operations data. The ThingWorx Native Interface integrates the Kepware KEPServerEX with ThingWorx easily and securely. This integration lets organizations take data streams from almost any manufacturing asset and present it in a useable format. The Kepware family also offers a predictive analytics engine in addition to other Machine-to-Machine (M2M) and Data Tunneling solutions.

Vuforia is PTC’s solution for creating rich augmented reality experiences for applications such as work instructions, user training / manuals, asset monitoring, and service instructions. It lets users leverage the richness of 3D and insights from IoT to deliver compelling augmented reality experiences the help improve efficiencies, build better products and enable safer, more productive workers.

One of the great aspects of ThingWorx is the ability to connect disparate data silos to a central IoT hub. Many of these silos are made accessible through Web APIs. RESTful Web APIs enable developers to pull data from an inexhaustible number of sources around the web; often using nothing but a HTTP URI. Salesforce has an extensive REST API that can be accessed through ThingWorx. This blog will introduce you to creating a “Connected App” on Salesforce, authentication using username and password in ThingWorx, adding records to Salesforce, and finally modifying records. For a detailed description of Salesforce’s REST API, visit https://developer.salesforce.com/page/REST_API

Step 1 (Optional): Obtain a Developer Environment with Salesforce.com

If you do not already have a Salesforce account, navigate to https://developer.salesforce.com/platform/force.com and sign up for a free developer environment. It only takes a few minutes and you get a fully functioning Salesforce instance that you can freely develop in.

Step 2: Obtain a Security Token

You’ll need a security token to authenticate with a username and password. If you don’t already have one, or can’t dig it up from previous emails, you’ll need to reset the token.

Resetting the Token

1.    In the upper right-hand corner of your Salesforce page, click on your name and select “My Settings”

2.    On the left-hand menu, select “Personal”

3.    Under “Personal,” select “Reset My Security Token”

4.    Follow the directions on the page and you will receive a new security token via email

Step 3: Create a Connected App

To use the REST API, we’ll need to create a connected app that gives us a “Consumer Key” and a “Consumer Secret”.

Creating the Connected App

1.    Click on “Settings” in the upper right of your Salesforce screen

2.    On the left side, navigate to “Build” > “Create” > “Apps”

3.    Under the “Connected Apps” section, select “New”

4.    Fill out the fields as shown below. A callback URL is required but we won’t really be referencing it anywhere in ThingWorx. There is a great article on using Postman to test out REST calls with Salesforce at https://blog.mkorman.uk/using-postman-to-explore-salesforce-restful-web-services/ . The callback URL is used in the examples when authenticating in Postman.

5.    Click “Save.” You will get an alert that your connected app will take 2-10 minutes to take effect.

6.    After you click “Save,” you’ll see the “Consumer Key” and “Consumer Secret.” Copy those somewhere to use in ThingWorx.

Step 4: Authenticate Salesforce Session in ThingWorx

In this step, we’ll create a service in ThingWorx that returns a JSON for us to use in our other Salesforce requests.

1.    Create a service inside your Thing called AuthenticateSalesForce. I have a “TestThing” that I’ve created where I can try out new services without disrupting any of my live projects.

2.    Choose the “STRING” type for the result output, no inputs are needed unless you want to have the end user input their username and password. After we test functionality, we’ll change the output type to “JSON”

3.    Enter the following code, which is just the POST JSON function in the ContentLoaderFunction resource.

var params = {

                 proxyScheme: undefined /* STRING */,
                 headers: undefined /* JSON */,
                 ignoreSSLErrors: undefined /* BOOLEAN */,
                 useNTLM: undefined /* BOOLEAN *
                 workstation: undefined /* STRING */,
                 useProxy: undefined /* BOOLEAN */,
                 withCookies: undefined /* BOOLEAN */,
                 proxyHost: undefined /* STRING */,

url: "https://login.salesforce.com/services/oauth2/token?grant_type=password&client_id=&client_secret=&username= &password=" /* STRING */,

                 content: undefined /* JSON */,
                 timeout: undefined /* NUMBER */,
                 proxyPort: undefined /* INTEGER */,
                 password: undefined /* STRING */,
                 domain: undefined /* STRING */,
                 username: undefined /* STRING */

};

// result: JSON
var j = Resources["ContentLoaderFunctions"].PostJSON(params);

var result = j.access_token;

4.    Enter the consumer key, consumer secret, username (use %40 for the ‘@’ symbol), and password plus security token (enter your password and security token with no spaces between the two)

5.    Select “Done” on your service, save your Thing, and test the service. You should receive a session token like the one seen below:

6.    If nothing shows up, either the Salesforce server hasn’t activated the app, or there may be an issue with the URL. If you copy and paste the URL into PostMan, you should get an error message that clarifies the issue.

7.    When you’re getting an access token as the result, edit your service, change the result type to “JSON,” delete the last line (the “var result = j.access_token” line”), and modify the end of the service to now read:

// result: JSON

var result = Resources[“ContentLoaderFunctions”].PostJSON(params);

Step 5: Create a record in Salesforce

In this step, we’ll create a new account within salesforce using our new authentication service and a REST call utilizing the ContentLoaderFunctions.

1.    Create another new service in your Thing and call it AddSalesForceAccount. 2.    Create an input and call it AccountName. The type is “STRING” 3.    Type in the following code:

var authJSON = me.AuthenticateSalesForce();

var token = authJSON.access_token;
var instance_url = authJSON.instance_url;

var url = instance_url + "/services/data/v20.0/sobjects/Account/";

var authString = "Bearer " + token;
var headers = {
   "authorization" : authString,
   "content-type" : "application/json"
};

var content = {
 "Name" : AccountName
};

var params = {
                 proxyScheme: undefined /* STRING */,
                 headers: headers /* JSON */,
                 ignoreSSLErrors: undefined /* BOOLEAN */,
                 useNTLM: undefined /* BOOLEAN */,
                 workstation: undefined /* STRING */,
                 useProxy: undefined /* BOOLEAN */,
                 withCookies: undefined /* BOOLEAN */,
                 proxyHost: undefined /* STRING */,
   url: url /* STRING */,
                 content: content /* JSON */,
                 timeout: undefined /* NUMBER */,
                 proxyPort: undefined /* INTEGER */,
                 password: undefined /* STRING */,
                 domain: undefined /* STRING */,
                 username: undefined /* STRING */
};

// result: JSON
var result = Resources["ContentLoaderFunctions"].PostJSON(params);

4. Test the service. Enter a unique account name and verify that it shows up in Salesforce.

Step 6: Retrieve a Record ID

To modify a record, the record ID must be used to reference the object of interest. We can make a request to Salesforce to return relevant records using an SOQL query. This example will cover retrieving the record ID of the account we just created in the last step.

1.    Create a new service in your Thing

2.    Create an input and call it AccountName. The type is “STRING”

3.    Type in the following code:

var authJSON = me.AuthenticateSalesForce();


var token = authJSON.access_token;
var instance_url = authJSON.instance_url;

var url = instance_url + "/services/data/v20.0/query/?q=SELECT+name+FROM+Account+WHERE+name+=+'" + AccountName + "'";

var authString = "Bearer " + token;
var headers = {
   "authorization" : authString,
   "content-type" : "application/json"
};




var params = {
                  proxyScheme: undefined /* STRING */,
                  headers: headers /* JSON */,
                  ignoreSSLErrors: undefined /* BOOLEAN */,
                  useNTLM: undefined /* BOOLEAN */,
                  workstation: undefined /* STRING */,
                  useProxy: undefined /* BOOLEAN */,
                  withCookies: undefined /* BOOLEAN */,
                  proxyHost: undefined /* STRING */,
                  url: url /* STRING */,
                  timeout: undefined /* NUMBER */,
                  proxyPort: undefined /* INTEGER */,
                  password: undefined /* STRING */,
                  domain: undefined /* STRING */,
                  username: undefined /* STRING */

};




// result: JSON
var j = Resources["ContentLoaderFunctions"].GetJSON(params);

var result = j.records[0].attributes.url;

4. Give the service a name and test it. The output of this service is a url that can be appended to the instance_url that is returned in the response from the Authentication service.

Step 7: Modify a Record

Using the output from our last service, we can now easily modify the fields of the record ID that we just retrieved. Keep in mind, if you create a custom field and you want to modify its value, add a “__c” to the end of the field name (denotes custom field).

  1. Create a new service in your Thing
  2. Let’s give it a few “STRING” inputs: field, stringValue, and AccountName
  3. Input the following code:
var authJSON = me.AuthenticateSalesForce();

var token = authJSON.access_token;
var instance_url = authJSON.instance_url;

var stringJSON = '{"' + field + '":' + stringValue + "}";


var params = {
                  AccountName: AccountName /* STRING */
};

// result: STRING
var object_url = me.RetrieveSalesForceAccountRecordID(params);

var url = instance_url + object_url + "?_HttpMethod=PATCH";
var authString = "Bearer " + token;
var headers = {
   "authorization" : authString,
   "content-type" : "application/json"
};

var content = JSON.parse(stringJSON);

var params = {
                  proxyScheme: undefined /* STRING */,
                  headers: headers /* JSON */,
                  ignoreSSLErrors: undefined /* BOOLEAN */,
                  useNTLM: undefined /* BOOLEAN */,
                  workstation: undefined /* STRING */
                  useProxy: undefined /* BOOLEAN */,
                  withCookies: undefined /* BOOLEAN */,
                  proxyHost: undefined /* STRING */,
                  url: url /* STRING */,
                  content: content /* JSON */,
                  timeout: undefined /* NUMBER */,
                  proxyPort: undefined /* INTEGER */,
                  password: undefined /* STRING */,
                  domain: undefined /* STRING */,
                  username: undefined /* STRING */
};
// result: JSON
var result = Resources["ContentLoaderFunctions"].PostJSON(params);

 

A Note About Security

Salesforce has a few ways to authenticate your session.  The method described in this blog is the least secure way because ThingWorx has visibility to the username and password of the Salesforce account.  There are two other ways to authenticate and both use callback URLs.  Basically, a user sends a call to the login endpoint and enters user and password information directly into the Salesforce environment.  Salesforce then redirects to a callback URL that is appended with an authorization token.  If you’d like to implement one of the more secure methods, I would suggest using a REST endpoint to a ThingWorx service as your callback URL. More specifically, create a service that has a string input called “code.” Now, change your callback URL in your Salesforce connected app to something like https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=&redirect_uri=>.  Now, when you navigate to the login link, it will send your authorization code to your ThingWorx service (this is because it appends “&code=” to the URL).  You’ll need to then send that code via the Content Loader Functions to receive your authorization token.  One thing to note is that the ThingWorx instance must be on HTTPS.  Salesforce does not allow HTTP callback URLs.  More information about Authentication can be found at https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_authentication.htm

If you have any questions about this blog or ThingWorx in general, don’t hesitate to leave a comment or contact EAC Product Development Solutions.