Coder Social home page Coder Social logo

trailheadapps / functions-recipes Goto Github PK

View Code? Open in Web Editor NEW
204.0 8.0 97.0 8.49 MB

Functions Recipes is a library of examples to help you getting started with Salesforce Functions and get used to their main features.

Home Page: https://developer.salesforce.com

License: Creative Commons Zero v1.0 Universal

Apex 2.61% HTML 7.79% JavaScript 69.46% CSS 1.97% TypeScript 0.89% Shell 0.01% Java 17.26%
salesforce functions

functions-recipes's People

Contributors

albarivas avatar dependabot[bot] avatar freddysilber avatar jjsfdc avatar julianduque avatar msducheminjr avatar pozil avatar schandlergarcia avatar svc-scm 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

functions-recipes's Issues

Java functions (java-functions branch) won't deploy on Windows due to CRLF line endings

Summary

Filing per-request of @schandlergarcia after chatting with him. If you check out this repo and switch to the java-recipes branch on a Windows machine, all of the line endings are (by default) CRLF. If you then try to start any of the Java functions in a local Docker container, things fail because the Linux host doesn't know how to process those files. I was able to work around this by running dos2unix recursively on the functions directory.

Hopefully this is something that can be captured in the repo as-is, or perhaps this is just something that must be documented for folks on Windows, but it could be an impediment for Windows folks test-driving Java-based functions via this repo.

Salesforce Org Type

Scratch Org

Function Language

Java

Steps To Reproduce

Should be captured in the summary, but let me know if not.

Current Behavior

Java functions can't be started in Windows until line endings are changed from CRLF to LF.

Expected Behavior

Should work without requiring explicit line ending conversions.

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

dot-sf in gitignore

Summary

The CLI now has the sf command and a user's local environment settings are stored in the .sf directory in the project, much like what happens with sfdx and the .sfdx directory. The .gitignore for this project is set up to ignore the .sfdx directory, but not the .sf directory.

Suggested Solution

Change gitignore to include .sf directory.

Alternative Solutions

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Winter '23: invalid value 'twoColumn' for attribute flowLayout

Summary

When deploying the Salesforce metadata to a Winter '23 org, the following error is returned:

        === Component Failures [1]
        
         Type  Name       Problem                                                                                                      
         ───── ────────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────── 
         Error Invocation Component [flowruntime:interview] attribute [flowLayout]: invalid value 'twoColumn' for attribute flowLayout 
        
        ERROR running force:source:push:  Push failed.

It seems this is a breaking change, even though the release notes say,

Starting in Winter ’23, two-column layouts are ignored.

Salesforce Org Type

Scratch Org

Function Language

No response

Steps To Reproduce

Deploy this project to a Salesforce org already upgraded to Winter '23.

Current Behavior

No response

Expected Behavior

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Functions is not a valid Features value.

Summary

Unable to create a scratch org with Functions as a feature.

Salesforce Org Type

Developer Edition Org

Function Language

JavaScript

Steps To Reproduce

  1. Authorise a sfdx project with a dev org
  2. Add one of the features in the config file as Functions
  3. run this command to create scratch org : sfdx force:org:create -s -f config/project-scratch-def.json -a fn-org

Current Behavior

The CLI throws an error saying : ERROR running force:org:create: Functions is not a valid Features value.

Expected Behavior

The CLI should create a scratch org

Relevant Log Output

ERROR running force:org:create:  Functions is not a valid Features value.

Code of Conduct

  • I agree to follow this project's Code of Conduct

"Browse The Docs" button causes "Home" page to navigate back one screen

Summary

The "Browse The Docs" button does open Functions documentation in a new browser tab, but if there were any other pages visited in the "Home" page's tab before pressing the button, the effect will be as if you pressed the "back" navigation button in your browser. You can return the the "Home" page by pressing the "forward" navigation button in your browser.

Salesforce Org Type

Scratch Org

Function Language

JavaScript

Steps To Reproduce

Using Chrome on Mac
Follow all of the instructions in README to set up Functions Recipes in a scratch org.
Open "Sales" using the App Launcher
Open "Functions Recipes" using the App Launcher
Press the "Browse The Docs" button
Note that Functions documentation opens in a new browser tab
Close that documentation browser tab

Current Behavior

The browser window that had contained "Functions Recipes" Home screen is currently on "Sales" Home screen

Expected Behavior

The browser window should be open to the "Functions Recipes" Home screen.

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Old API version returned in OrgInfo function

Summary

When execution the OrgInfo recipe, the function returns API version 53.0 whereas the org is on Spring '22 (API v54.0).

Screen Shot 2022-02-16 at 14 47 15

Salesforce Org Type

Scratch Org

Function Language

TypeScript

Steps To Reproduce

Run the OrgInfo function with the Run Function button.

Current Behavior

"apiVersion": "53.0"

Expected Behavior

"apiVersion": "54.0"

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

enable functions button missing

Summary

I want to enable functions to start using the recipes repo, but can't seem to enable the feature in my dev hub, am I missing a step possibly? Thanks so much for taking a look, I'm working from this document - https://developer.salesforce.com/docs/platform/functions/guide/configure_your_org.html

image

Salesforce Org Type

Developer Edition Org

Function Language

No response

Steps To Reproduce

No response

Current Behavior

No response

Expected Behavior

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Java Projects with 3rd Party JAR file examples

Summary

Hi Team,

Can you add a Sample Example or guide me How to We Use a 3rd party JAR file which are not available on Maven as Dependency but given by some vendor for a Function using java language.
I want to know following things

  1. where to keep the JAR file
  2. How to specify the Path for the JAR file will it be a relative Address or we need to store it in a Folder.
  3. How do we deploy the function containing 3rd party local JAR

Suggested Solution

No response

Alternative Solutions

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Please Tag release corresponding to GA release of Functions

Summary

Would like to be able to quickly reference the GA release.

Suggested Solution

Git tag will allow me to quickly reference the GA release.

Alternative Solutions

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Adjust Functions Permset To Explicitly Include Account Fields

Summary

The instructions in the README explain how to get Functions Recipes working in a scratch org, and they work. But, when I get Functions Recipes into a production org, some examples fail for lack of access to Account fields. For example, the "SalesforceSDK" recipe fails with this error: Function threw: Failed to insert record. Root Cause: No such column 'AccountNumber' on sobject of type Account

Suggested Solution

If you add the following explicit write permissions to the Functions permission set, the recipes behave correctly:

Account.AccountNumber
Account.Industry
Account.Type
Account.Website

Alternative Solutions

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

01_Intro_ProcessLargeData_Java does not calculate distance correctly

Summary

The calculate distance functions between the Java and JS versions of 01_Intro_ProcessLargeData do not calculate similar distances. The Java version is missing the dist = dist * 60 * 1.1515; statement that exists in the JS version of the distance function.

// java
distance(36.169090, -115.140579, 36.1657, -115.141);
// => 0.003406994620636472
// js
distance(36.169090, -115.140579, 36.1657, -115.141);
// => 0.23538925833977384

The JS implementation with the dist = dist * 60 * 1.1515; is more accurate than the Java implementation. Will open a PR to correct the Java version and add an assertion about the distance in tests for both Java and JavaScript.

Salesforce Org Type

Developer Edition Org

Function Language

Java

Steps To Reproduce

Call distance with any set of coordinates in the Java version. Compare the distance to the coordinates in Google Maps.

Current Behavior

No response

Expected Behavior

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Incorrect Java class name

The Java class name for JsonResponse.java in the Process Large Data Volumes recipe is incorrect in the UI (see screenshot).
image

These are the files referencing "JavaResponse.java" instead of "JsonReponse.java".
image

Metadata deploy error: Find_Schools School_Section1, regionContainerType is required

Summary

The Salesforce metadata fails to deploy:

        *** Pushing v55.0 metadata with SOAP API v54.0 connection ***
        DEPLOY PROGRESS | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 0/36 Components
        DEPLOY PROGRESS | ███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 3/36 Components
        DEPLOY PROGRESS | ███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 3/36 Components
        DEPLOY PROGRESS | ████████████████░░░░░░░░░░░░░░░░░░░░░░░░ | 14/36 Components
        DEPLOY PROGRESS | ████████████████░░░░░░░░░░░░░░░░░░░░░░░░ | 14/36 Components
        DEPLOY PROGRESS | ██████████████████████░░░░░░░░░░░░░░░░░░ | 20/36 Components
        DEPLOY PROGRESS | ███████████████████████░░░░░░░░░░░░░░░░░ | 21/36 Components
        DEPLOY PROGRESS | ███████████████████████░░░░░░░░░░░░░░░░░ | 21/36 Components
        DEPLOY PROGRESS | ██████████████████████████████░░░░░░░░░░ | 27/36 Components
        DEPLOY PROGRESS | ██████████████████████████████░░░░░░░░░░ | 27/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ██████████████████████████████████░░░░░░ | 31/36 Components
        DEPLOY PROGRESS | ███████████████████████████████████████░ | 35/36 Components
        DEPLOY PROGRESS | ███████████████████████████████████████░ | 35/36 Components
        DEPLOY PROGRESS | ████████████████████████████████████████ | 35/35 Components
        
        
        === Component Failures [1]
        Type   Name          Problem
        ─────  ────────────
        ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
        Error  Find_Schools  School_Section1 (Screen Component) - Because the
        "School_Section1" screen field on the "School" screen is a section, the
        regionContainerType is required.
        
        ERROR running force:source:push:  Push failed.

Salesforce Org Type

Scratch Org

Function Language

No response

Steps To Reproduce

sfdx force:source:push this repo source to a Functions-enabled scratch org.

Current Behavior

Salesforce throws an error.

Expected Behavior

Salesforce to complete the source deployment.

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

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.