Giter Club home page Giter Club logo

recordviewer's Introduction

RecordViewer—Node.js

This Node.js app shows you how easy it is to use the Salesforce User Interface API to create, read, update, and delete Salesforce records.

Salesforce uses User Interface API to build the Salesforce1 and Lightning Experience apps. Not only do you get data and metadata in a single response, but the response matches metadata changes made to the org by Salesforce admins. You don’t have to worry about layouts, picklists, field-level security, or sharing—all you have to do is build an app that users love.

Set Up the App

  1. To authenticate Record Viewer with a Salesforce org, in the org, configure a connected app.
    • For the Callback URL, enter https://localhost:8443/oauth-redirect. If you deploy the app to Heroku, Heroku will provide a different callback URL. Create a new Connected App using the Heroku callback URL.
    • Make a note of the OAuth consumer key to enter on the home page of the Record Viewer app.
  2. To allow the app to make cross-domain requests to Salesforce, in the org, choose Setup > CORS.
    1. Click New.
    2. For Origin URL Pattern, enter https://localhost:8443. If you're deploying to heroku, enter https://*.herokuapp.com or https://some-domain.herokuapp.com.
  3. Clone the RecordViewer repository.
  4. Set up Docker.
  5. To build and start the servers, run this Docker Compose command.
    docker-compose build && docker-compose up -d
  6. After Docker finishes building and starts the containers, the web application is available at https://localhost:8443/.

Forward Ports

If you're running docker in a VM, be sure to forward the ports exposed in your containers. This script forwards open ports in the boot2docker-VM.

for i in {49000..49900}; do
    VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$i,tcp,,$i,,$i";
    VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$i,udp,,$i,,$i";
done

Use the Record Viewer App

To view a record, click a record in the Recent Items list. This list contains recently used items. If you don't see any records, go to your Salesforce org and select a record or two, then return to the Record Viewer app.

When viewing a record, you can click to Edit, Delete, or Clone the record.

To create a record, navigate to the app's home page and select an object from the dropdown. User Interface API supports all custom objects and some standard objects. If you select an unsupported object, the app will let you know.

To see the response from User Interface API that the app uses to build the page, click Show JSON.

(Optional) Deploy to Heroku

Deploy

Deploy to Heroku Using Docker

All of the instructions below assume that you are within the root of the project directory.

  1. Install the Heroku CLI

  2. Log into Heroku through the command line

    heroku login
  3. Log into the Heroku Container Registry

    heroku container:login
  4. The Heroku application must be created

    heroku create
  5. Deploy the application

    heroku container:push web

(Optional) Set the Default Login URL and Consumer Key

After creating the Connected App in Salesforce, follow these steps to set the default Login URL and Consumer Key on the default page.

  1. To set the Login URL, run this command.

    heroku config:set LOGIN_URL={url}

    Substitute {url} with the URL of the server that the org is on.

  2. To set the Consumer Key, run this command.

    heroku config:set CONSUMER_KEY={key}

    Substitute {key} with the value from the Consumer Key field in the Connected App details.

recordviewer's People

Contributors

cseymoursf avatar cyemparala avatar dexwiz avatar jbleylesf avatar svc-scm avatar vishal-motwani avatar zbaysf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recordviewer's Issues

docker-compose build failed because docker-credential-gcloud is not installed or not available in PATH

Hi,

I installed Docker Desktop on my Mac.

When running the docker-compose build && docker-compose up -d command, I get the following error

Building web
Traceback (most recent call last):
File "docker-compose", line 6, in
File "compose/cli/main.py", line 72, in main
File "compose/cli/main.py", line 128, in perform_command
File "compose/cli/main.py", line 303, in build
File "compose/project.py", line 403, in build
File "compose/project.py", line 385, in build_service
File "compose/service.py", line 1106, in build
File "site-packages/docker/api/build.py", line 261, in build
File "site-packages/docker/api/build.py", line 308, in _set_auth_headers
File "site-packages/docker/auth.py", line 311, in get_all_credentials
File "site-packages/docker/auth.py", line 262, in _resolve_authconfig_credstore
File "site-packages/docker/auth.py", line 287, in _get_store_instance
File "site-packages/docker/credentials/store.py", line 25, in init
docker.credentials.errors.InitializationError: docker-credential-gcloud not installed or not available in PATH
[55226] Failed to execute script docker-compose

Can you help me please?

Cannot find module 'inline-style-prefixer/static'

Hello I have this ERROR, Any idea please?

Step 8/9 : RUN npm run build
---> Running in fd65e01f4536

[email protected] build /usr/src/app
browserify -t [babelify --presets ['env' 'react' 'stage-2'] ] client-src/root.
js -o lib/root.js

Error: Cannot find module 'inline-style-prefixer/static' from '/usr/src/app/node
_modules/narcissus/build'
at /usr/src/app/node_modules/browser-resolve/node_modules/resolve/lib/async.
js:46:17
at process (/usr/src/app/node_modules/browser-resolve/node_modules/resolve/l
ib/async.js:173:43)
at ondir (/usr/src/app/node_modules/browser-resolve/node_modules/resolve/lib
/async.js:188:17)
at load (/usr/src/app/node_modules/browser-resolve/node_modules/resolve/lib/
async.js:69:43)
at onex (/usr/src/app/node_modules/browser-resolve/node_modules/resolve/lib/
async.js:92:31)
at /usr/src/app/node_modules/browser-resolve/node_modules/resolve/lib/async.
js:22:47
at FSReqWrap.oncomplete (fs.js:152:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: browserify -t [babelify --presets ['env' 're act' 'stage-2'] ] client-src/root.js -o lib/root.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-04-15T16_02_14_664Z-debug.log
ERROR: Service 'web' failed to build: The command '/bin/sh -c npm run build' ret
urned a non-zero code: 1

Upgrade Babel

npm WARN deprecated [email protected]: We're super 😸  excited that you're trying to use ES2017+ syntax, but instead of making more yearly presets 😭 , Babel now has a better preset that we recommend you use instead: npm install babel-preset-env --save-dev. preset-env without options will compile ES2015+ down to ES5 just like using all the presets together and thus is more future proof. It also allows you to target specific browsers so that Babel can do less work and you can ship native ES2015+ to user 😎 ! We are also in the process of releasing v7, so please give http://babeljs.io/blog/2017/09/12/planning-for-7.0 a read and help test it out in beta! Thanks so much for using Babel 🙏, please give us a follow on Twitter @babeljs for news on Babel, join slack.babeljs.io for discussion/development and help support the project at opencollective.com/babel
npm WARN deprecated [email protected]: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! 
npm WARN deprecated [email protected]: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! 
npm WARN deprecated [email protected]: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! 
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN lifecycle [email protected]~postinstall: cannot run in wd %s %s (wd=%s) [email protected] browserify -t [babelify --presets ['latest' 'react' 'babel-polyfill' 'stage-2'] ] client-src/root.js -o lib/root.js /usr/src/app
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Docker 18.06.0+ and docker-compose.yml upgrade

It should be mentioned that once you use the current version of the docker-compose.yml file together with Docker 18.06.0+ you may encounter a problem with compatibility. You can fix it by explicitly adding 2 sections:

version: '2.1'
services:

  web:
    build: .
    command: 'bash -c ''node app.js'''
    working_dir: /usr/src/app
    environment:
      PORT: 8050
      NGINX_PORT: 8443
    volumes:
      - './views:/app/user/views:ro'
  nginx:
    build: nginx
    ports:
      - '8080:80'
      - '8443:443'
    links:
      - web:web
    volumes_from:
      - web

Add named constants for /record-ui params

In recordFetcher.js, we should add params with default values to the /ui-api/record-ui request for learning purposes. Right now, we include formFactor=Large, but not layoutTypes=Full. @cseymourSF said, "i think we should include both as named constants in the code."

Add a LICENSE file

Thanks for publishing the source.

Would it be possible to publish a LICENSE file specifying the open source license this is licensed under? Some developers have employment agreements that prevent them from contributing to open source projects unless they have particular licenses.

If you need help picking a license, check out https://choosealicense.com/

API 43 not available

I was trying to do the Install Sample App step of the User Interface API Module, and it threw errors of 404 not found. I changed the api back to 42 and now it works.

In my developer account and playgrounds the 43 version is not available yet.

Codestyle: mixed ES6 and ES5 features usage

In many places the features from ES5 and ES6 are mixed:

  • const and var are used instead of const+let
  • strings with parameters are created via concatenation instead of ES6 template strings

All this stuff make code reading painful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.