• ethanone
  • NEWBIE
  • 174 Points
  • Member since 2009

  • Chatter
    Feed
  • 5
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 68
    Questions
  • 82
    Replies

I want to create an opprtunity trigger but wheni go to Customze| Opportunities|Triggers

 

I don't see a new or create button

 

Am i blind??

I've got a custom request object and I'd like to create an action button with LWC that prompts the user to add a note and a file then posts the note and file to the chatter feed and changes the status of the record. I do not want to use Aura if possible. I'm not sure how to open a modal from an action button (something like the below)
<lightning-button label="Submit" slot="actions" onclick={handleSubmitClick}></lightning-button>
I'm not sure how to add an entry to the feed. Is this even possible with LWC?

Lastly, I'm not sure how to modify the record without using the lightning-record-form. Is Apex method the only option?
 
How can I create a LWC that displays all the associated attachments/files for a given record?
How do I display the fields from a person account related to an opportunity (mine happens to be custom)?

Simple code example below. How do I display fields from the related person account based on the AccountId__c? Do I need a separate component? if so, how do I connect them?
import { LightningElement, api } from "lwc";

import NAME_FIELD from "@salesforce/schema/lda_Opportunity__c.Name";
import ACCOUNT_FIELD from "@salesforce/schema/lda_Opportunity__c.AccountId__c";

export default class SimpleDeal extends LightningElement {
  @api recordId;
  @api objectApiName;

  objectApiName = "lda_Opportunity__c";
  fields = [NAME_FIELD, ACCOUNT_FIELD];
}
Corresponding html:
<template>
    <lightning-card title="Deal Info" icon-name="custom:custom14">
        <lightning-record-form
            record-id={recordId}
            object-api-name={objectApiName}
            fields={fields}>
        </lightning-record-form>
    </lightning-card>
</template>
Thanks in advance.
I'm trying to create child records when a user checks a checkbox widget (and delte when unchecked). I've tried to put a createRecord() and deleteRecord() in the change handler for the checkbox, but i get "Uncaught (in promise) TypeError: Cannot read property 'dispatchEvent' of undefined"

I've also tried to put the createRecord in a separate button, which will create the record, but will also create duplicates and requires looking for multiple changes rather than reacting to each click like I might in the checkbox handler.

Below is the checkbox change handler. I'm getting errors on the dispatch event (misusing the this. perhaps?) removing this.dispatchEvent() eliminates the error, but records are neither created nor deleted and I don't know why. Please help me better understand creating and deleteing records. Thanks in advance.
handleChange(e) {
    const beforeChangeList = this.selectedOptions;
    const afterChangelist = e.detail.value;
    const aRecId = this.recordId;
    this.selectedOptions = e.detail.value;

    console.log("before >>>> " + beforeChangeList);
    console.log("after >>>> " + afterChangelist);

    // Compare list for adds
    afterChangelist.forEach(function(element) {
      if (beforeChangeList.includes(element)) {
        console.log(">>>>, do nothing for " + element);
      } else {
        console.log(">>>>, add " + aRecId + " - " + element);
        const fields = { DealID: aRecId, Agent_Order__c: 1, Agent__c: element };
        const recordInput = { apiName: COMMISSION_OBJECT.objectApiName, fields };
        console.log(">>>> add " + JSON.stringify(recordInput));
        createRecord(recordInput)
          .then(lda_commission__c => {
            this.dispatchEvent(
              new ShowToastEvent({
                title: "Success",
                message: "Commission added",
                variant: "success"
              })
            );
            console.log(">>>> record created");
          })
          .catch(error => {
            this.dispatchEvent(
              new ShowToastEvent({
                title: "Error creating record",
                message: reduceErrors(error).join(", "),
                variant: "error"
              })
            );
            console.log(">>>> record not created." + reduceErrors(error).join(", "));
          });
      }
    });

    // Compare list for deletes
    beforeChangeList.forEach(function(element) {
      if (afterChangelist.includes(element)) {
        console.log(">>>>, do nothing for " + element);
      } else {
        console.log(">>>>, drop " + element);
        deleteRecord(element)
          .then(() => {
            this.dispatchEvent(
              new ShowToastEvent({
                title: "Success",
                message: "Commission is deleted",
                variant: "success"
              })
            );
            console.log(">>>> comm deleted");
          })
          .catch(error => {
            this.dispatchEvent(
              new ShowToastEvent({
                title: "Error while deleting commission",
                message: error.message,
                variant: "error"
              })
            );
            console.log(">>>> com not deleted." + error.message);
          });
      }
    });
  }

 
I’m trying to build a LWC that displays a checkbox group created from the list of active users in the same sales market as the current user.

Html file (based on component reference):
<template>
        <lightning-checkbox-group name="Checkbox Group"
                                label="Select a User"
                                options={comms}
                                value={value}
                                onchange={handleChange}>
        </lightning-checkbox-group>
        <p>Selected Values are: {selectedValues}</p>
</template>
js file:
import { LightningElement, api, track, wire } from "lwc";
import getMktUsers from "@salesforce/apex/Top100.getMktUsers";
import getCommissions from "@salesforce/apex/Top100.getCommissions";
import Id from "@salesforce/user/Id";

let url_string = window.location.href;
let url = new URL(url_string);
let rid = url.searchParams.get("Id");

export default class Top100 extends LightningElement {
  @api recordId;
  @api objectApiName;
  @api userId;
  @track value = ["Option1"];
  userId = Id;
  recordId = rid;

  @wire(getMktUsers, { usrId: "$userId" }) MktUsers;
  @wire(getCommissions, { rid: "$recordId" }) selectedVals;

  objectApiName = "lda_Opportunity__c";

  get comms() {
    return [{ label: "Ross", value: "Option1" }, { label: "Rachel", value: "Option2" }];
  }

  get selectedValues() {
    return this.value.join(",");
  }

  handleChange(e) {
    this.value = e.detail.value;
  }
}
Apex file:
public with sharing class Top100 {
    @AuraEnabled(cacheable=true)
    public static List<Account> getMktUsers(Id usrId) {
        User ThisUser = [SELECT Id, Name, Office__c FROM User WHERE Id = :usrId LIMIT 1];
        List<User> MarketUsers = [SELECT Id FROM User WHERE Office__c = :ThisUser.Office__c and IsActive = True];
        //Users have matching Person accounts because some opportunities involve external sales people.
        return [SELECT Id, Name, FirstName, LastName FROM Account WHERE UserLookup__c IN :MarketUsers];
    }

    @AuraEnabled(cacheable=true)
    public static List<String> getCommissions(Id rid){
        List<String> values = new List<String>();
        for (lda_Commission__c comm : [SELECT Agent__c, Agent__r.Name FROM lda_Commission__c WHERE DealId__c = :rid]){
            values.add(comm.Agent__c);
        }
        System.debug('Values: ' + values);
        return values;
    }
}
1) How do I take the results of my Apex function and format it for the checkbox group options parameter?
2) How do I take the results of my getCommissions Apex function and format it for the checkbox group value parameter?



 
I'm trying to display the list of acitve users in the same branch office as the logged in user in a LWC.
I have an apex class that looks like this:
@AuraEnabled(cacheable=true)
    public static List<User> getMktUsers(String usrId) {
        User ThisUser = [SELECT Id, Name, Office__c FROM User WHERE Id = :usrId LIMIT 1];
        return [SELECT Id, Name FROM User WHERE Office__c = :ThisUser.Office__c and IsActive = True];
    }
I have refer to it in my LWC js file like this:
import { LightningElement, api, track, wire } from "lwc";
import getMktUsers from "@salesforce/apex/Top100.getMktUsers";
import Id from "@salesforce/user/Id";

export default class Top100 extends LightningElement {
  @wire(getMktUsers, { usrId: { Id } }) wiredUsers;
}
I call it in my html file like this:
<ul class="slds-list_ordered">
            <template for:each={wiredUsers.data} for:item="wuser">
                <li key={wuser.Id}>
                    {wuser.Name}
                </li>
            </template>
        </ul>
I'm able to get lists of users to appear if I hard code the office name, but when I try to pass in the Id to determie the current user's office, i get nothing appearing. I do not know how to debug this. Can anyone help?
 
I'm trying to rewrite some older visualforce pages that will work for both my lightning and classic users. I'd prefer using LWC since it is the recommended approach to new projects and much less complicated. However it does not work with Lightning out. Now that LWC is open-sourced, could I write an opensource LWC component and present it on both a lighting record page for lightning users as well as a VF page for classic users?
I'm trying to create a proof of concept of a lightning component running in a lightning out page not on the SFDC platform. I've got a basic component called test.cmp:
<aura:component
  implements="flexipage:availableForRecordHome, force:hasRecordId"
>
  <aura:attribute name="recordId" type="String" />
  <lightning:card title="Display, Create, or Edit Records">
    <lightning:recordForm
      recordId="{!v.recordId}"
      objectApiName="Account"
      fields="Name"
    />
  </lightning:card>
</aura:component>
A basic lightning app called ltngOutTest.app:
<aura:application access="GLOBAL" extends="ltng:outApp">
    <aura:dependency resource="c:test" />
</aura:application>
and web page on my server called ltngOut2.html:
<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">

  <title>Lightning Out Example</title>

</head>

<body>
    <script src="https:/myDomain.my.salesforce.com/lightning/lightning.out.js"></script>
    
    <div id="cmpGoesHere"/>
    
    <script>
    $Lightning.use("c:ltngOutTest",    // name of the Lightning app
        function() {                  // Callback once framework and app loaded
            $Lightning.createComponent(
                "c:test", // top-level component of your app
                { },                  // attributes to set on the component when created
                "cmpGoesHere",   // the DOM location to insert the component
                function(cmp) {
                    // callback when component is created and active on the page
                }
            );
        },
        'https://myDomain.lightning.force.com.lightning.force.com/'
    );
</script>
</body>
</html>
I think I'm missing the OAuth component, but I don't know how to include it. What else am I missing?
Thanks in advance.

 
When running a flow in Classic, lightning runtime works great to allow uploading files. When the same flow is wrapped in a VisualForce page (so that you can use the button override), lightning runtime does not work. How can i either A) override a button with a flow NOT using Visualforce or B) enable lightning runtime on a flow wrapped in a VisualForce page?
I used to use the Eclipse Force IDE and I'm switching to VSCode/SFDX. When creating a project in Force IDE, you could specify retreiving "Apex, Lightning, and Visualforce (classes, triggers, test suites, LIghtinging component bundles, pages, Visualforce comonents, and static resources)" 
It appears the -m option of sfdx force:sourc:retrieve could alow for grabbing these same items, but what -m options do I specify? What options are necessary to retrieve new development items (Aura, LWC, etc)?
The Lightning Record Page Highlights Panel is too limited (only shows 7 fields).

What is the best method to make custom highlights panel that maintians the lightning look and feel? Would it be VF with SLDS? Would it be a Lightning Web Component? Would it be an Aura component?

I'd prefer to use the new best way (as of Winter '19). Is that LWC?
I'm creating a ContentNote record from a form using remote objects, but if the user enters a quote or double quote on the form, the ContentNote record is not created. If I create a note in the feed on a standard page, quotes and double quotes do not cause issues. How can I encapsulate the form entry to allow for double quotes rather than strip them out?
I need to allow a user to find a record of a custom object by either the Name or an external ID. I'm trying to build a search/lookup using Flow and it seems that if want even a little fuzziness in the search (OR logic), i need to use SOQL meaning i need to use Apex. Below is a basic example looking up accounts. I've added it to my flow, but I'm unable to get the list of accounts back to the flow for output. In fact, the flow won't even let my choose an appropriate variable (either an sobject collection or a collection variable). How do I get these results back into my Flow?
global class lookUpAccount {
    @InvocableMethod
    public static List<Account> getAccts(List<String> srchPhrases){
        List<Account> accts = [SELECT Id, Name FROM Account WHERE Name LIKE :srchPhrases];
        return accts;
	}
}

Since Dynamic Record Choice won't allow me to search by Name or ID, Is there is another approach to allowing a user to look for and select a record?
I want to send an email and create a new record for a custom object, lda_Request__c. If there is an attachment on the email, i want it to be associated with the new record. The code below is 100% covered and tests appear to create the ContentVersion object, but when I send a real email with a real attachment, the new record is created, but there is no sign of the new ContentVersion record nor the ContentDocumentLink record and I get no errors. Can anyone please help?
 
global class ResearchRequestByEmail implements Messaging.InboundEmailHandler {
 
    global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, Messaging.InboundEnvelope env){
        
        // Create an InboundEmailResult object for returning the result of the Apex Email Service
        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
        
        String PTSubject = '';
        PTSubject = email.subject;
        string myHTMLBody = '';
        myHTMLBody = email.htmlBody;
        
        // Get User Id
        User Apprvr = [SELECT Id, Name FROM User WHERE Email = :email.fromAddress LIMIT 1];
        
        // Create new Request
        lda_Request__c request = new lda_Request__c();
        request.Approver__c = Apprvr.Id;
        request.Request_Subject__c = PTSubject;
        request.Request_Details__c = myHTMLBody;
        request.Via_Email__c = True;
        request.Status__c = 'New';
        request.Property_Description_Method__c = 'Via Email';
        insert request;

        // Attachments using Content Version
        if (email.binaryAttachments != null){
            for (Messaging.InboundEmail.binaryAttachment binAttach :email.binaryAttachments){
                ContentVersion cv = new ContentVersion();
                cv.VersionData = binAttach.body;
                cv.Title = binAttach.fileName;
                cv.PathOnClient = binAttach.fileName;
                //cv.FirstPublishLocationId = request.Id;
                insert cv;
                
                cv = [select ContentDocumentId from ContentVersion where id = :cv.id limit 1];

                ContentDocumentLink cdl = new ContentDocumentLink();
                cdl.LinkedEntityId = request.Id;
                cdl.ContentDocumentId = cv.ContentDocumentId;
                cdl.ShareType = 'V';
                insert cdl;
            }
        }
        result.success = true;
        
        // Return the result for the Apex Email Service
        return result;
    }
}

 
Is there an easy way to remove the "CY" from year labels on charts? I'd rather not make a custom chart just to change labels. I just need it to say "2016" instead of "CY2016"
I recently got an email for some DE orgs saying:"If your DE org is locked and you would like to regain access, you can open a case with Customer Support via the Help & Training portal."

So, I managed to find the new place to log a case (not easy) to unlock my DE org and there is a message that says: "Developer support for standard customers and partners is supported directly through our community. If you have a developer support question, please click here."

Can the "community" unlock my DE org? What do I do?
Any idea how to move old notes to the new enhanced notes and maintain the original owner/creator and date/time?
Kind of a basic question, but I've seen several ways to set up an object variable and I don't know which is best or if there is any difference.
One Method:
public with sharing class myExtension{
    public Account myAccount{get;set;}
    
    public myExtension(ApexPages.StandardController controller){
        getmyAccount();
    }
    
    public void myAccount(){
        myAccount = [SELECT Id, Name FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }
}
Another Method
public with sharing class myExtension{
    public Account myAccount{
        get{
            if (myAccount != null) return myAccount;
            myAccount = [SELECT Id, Name FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
            return myAccount;
        }
        private set;
    }
    
    public myExtension(ApexPages.StandardController controller){

    }
}

Yet Another:
public with sharing class myExtension{
    public Account myAccount;
    
    public myExtension(ApexPages.StandardController controller){
		myAccount = [SELECT Id, Name FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }
}

And I'm sure there are many other ways and variations out there. But what is the best way? And why is it better (fewer lines, less execution, more reusable, etc)?
I need to look for changes in a list of fields in a record using a trigger. How can I reference the list of fields and append it to the trigger.new and the trigger.old references?

Below is code I've tried to use, but my variable "s" is not recognized. Thanks for any help you can provide.
Map<Id, lda_Opportunity__c> MPPMap = new Map<Id, lda_Opportunity__c>();

list<Schema.SObjectField> FieldList = new list<Schema.SObjectField>();
FieldList.add(lda_Opportunity__c.Location__c); // Many more fields to add
        
for (integer i=0; i < trigger.new.size(); i++){
   for (Schema.SObjectField s : FieldList){
      if (trigger.new[i].s != trigger.old[i].s){
         MPPMap.put(trigger.new[i].Id, trigger.new[i]);
      }
   }
}

 
I recently got an email for some DE orgs saying:"If your DE org is locked and you would like to regain access, you can open a case with Customer Support via the Help & Training portal."

So, I managed to find the new place to log a case (not easy) to unlock my DE org and there is a message that says: "Developer support for standard customers and partners is supported directly through our community. If you have a developer support question, please click here."

Can the "community" unlock my DE org? What do I do?
I need to look for changes in a list of fields in a record using a trigger. How can I reference the list of fields and append it to the trigger.new and the trigger.old references?

Below is code I've tried to use, but my variable "s" is not recognized. Thanks for any help you can provide.
Map<Id, lda_Opportunity__c> MPPMap = new Map<Id, lda_Opportunity__c>();

list<Schema.SObjectField> FieldList = new list<Schema.SObjectField>();
FieldList.add(lda_Opportunity__c.Location__c); // Many more fields to add
        
for (integer i=0; i < trigger.new.size(); i++){
   for (Schema.SObjectField s : FieldList){
      if (trigger.new[i].s != trigger.old[i].s){
         MPPMap.put(trigger.new[i].Id, trigger.new[i]);
      }
   }
}

 
I'm trying to edit multiple records with a list controller extension. I want to use the standard controller {!Save} action, so I only need to use the extension to limit the records I want to show up in my list. The problem is that when I include the list controller extension in my VF page, my edits are not saved. Below is my code for page and extension respectively. Please let me know what I'm doing wrong. If I need to write a custom {!Save} action, please help guide me on how to do that. Thanks for your help!

Visualforce page (called customCommissionEdit):
<apex:page standardController="lda_Commission__c" recordSetVar="TheseCommissions" extensions="extCustomCommissionList">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages ></apex:pageMessages>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="quicksave" action="{!quicksave}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!TheseCommissions}" var="comm">
                <apex:column value="{!comm.name}"/>
                <apex:column value="{!comm.Agent_Order__c}"/>
                <apex:column value="{!comm.Agent__c}"/>
                <apex:column value="{!comm.Comm_Dollars__c}"/>
                <apex:column value="{!comm.Comm_Pct__c}"/>
                <apex:column headerValue="Commission Percent">
                    <apex:inputField value="{!comm.Comm_Pct__c}"/>
                </apex:column>
                <apex:column value="{!comm.LAO_Agent__c}"/>
                <apex:column value="{!comm.Role__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller extension (called extCustomCommissionList):
public with sharing class extCustomCommissionList {

    public extCustomCommissionList(ApexPages.StandardSetController controller) {
    }

     public list<lda_Commission__c> getTheseCommissions() {
            return [SELECT DealID__c, Name, Agent__c, LAO_Agent__c, Agent_Order__c, Comm_Dollars__c, Comm_Pct__c, Fiduciary__c, Role__c FROM lda_Commission__c WHERE DealID__c = :ApexPages.currentPage().getParameters().get('id')]; 
        } 
}

The lda_Commission__c object that I'm trying to edit is a child to another object, so I just want the user to edit the related child lda_Commission__c.

 
I'm trying to create child records when a user checks a checkbox widget (and delte when unchecked). I've tried to put a createRecord() and deleteRecord() in the change handler for the checkbox, but i get "Uncaught (in promise) TypeError: Cannot read property 'dispatchEvent' of undefined"

I've also tried to put the createRecord in a separate button, which will create the record, but will also create duplicates and requires looking for multiple changes rather than reacting to each click like I might in the checkbox handler.

Below is the checkbox change handler. I'm getting errors on the dispatch event (misusing the this. perhaps?) removing this.dispatchEvent() eliminates the error, but records are neither created nor deleted and I don't know why. Please help me better understand creating and deleteing records. Thanks in advance.
handleChange(e) {
    const beforeChangeList = this.selectedOptions;
    const afterChangelist = e.detail.value;
    const aRecId = this.recordId;
    this.selectedOptions = e.detail.value;

    console.log("before >>>> " + beforeChangeList);
    console.log("after >>>> " + afterChangelist);

    // Compare list for adds
    afterChangelist.forEach(function(element) {
      if (beforeChangeList.includes(element)) {
        console.log(">>>>, do nothing for " + element);
      } else {
        console.log(">>>>, add " + aRecId + " - " + element);
        const fields = { DealID: aRecId, Agent_Order__c: 1, Agent__c: element };
        const recordInput = { apiName: COMMISSION_OBJECT.objectApiName, fields };
        console.log(">>>> add " + JSON.stringify(recordInput));
        createRecord(recordInput)
          .then(lda_commission__c => {
            this.dispatchEvent(
              new ShowToastEvent({
                title: "Success",
                message: "Commission added",
                variant: "success"
              })
            );
            console.log(">>>> record created");
          })
          .catch(error => {
            this.dispatchEvent(
              new ShowToastEvent({
                title: "Error creating record",
                message: reduceErrors(error).join(", "),
                variant: "error"
              })
            );
            console.log(">>>> record not created." + reduceErrors(error).join(", "));
          });
      }
    });

    // Compare list for deletes
    beforeChangeList.forEach(function(element) {
      if (afterChangelist.includes(element)) {
        console.log(">>>>, do nothing for " + element);
      } else {
        console.log(">>>>, drop " + element);
        deleteRecord(element)
          .then(() => {
            this.dispatchEvent(
              new ShowToastEvent({
                title: "Success",
                message: "Commission is deleted",
                variant: "success"
              })
            );
            console.log(">>>> comm deleted");
          })
          .catch(error => {
            this.dispatchEvent(
              new ShowToastEvent({
                title: "Error while deleting commission",
                message: error.message,
                variant: "error"
              })
            );
            console.log(">>>> com not deleted." + error.message);
          });
      }
    });
  }

 
I’m trying to build a LWC that displays a checkbox group created from the list of active users in the same sales market as the current user.

Html file (based on component reference):
<template>
        <lightning-checkbox-group name="Checkbox Group"
                                label="Select a User"
                                options={comms}
                                value={value}
                                onchange={handleChange}>
        </lightning-checkbox-group>
        <p>Selected Values are: {selectedValues}</p>
</template>
js file:
import { LightningElement, api, track, wire } from "lwc";
import getMktUsers from "@salesforce/apex/Top100.getMktUsers";
import getCommissions from "@salesforce/apex/Top100.getCommissions";
import Id from "@salesforce/user/Id";

let url_string = window.location.href;
let url = new URL(url_string);
let rid = url.searchParams.get("Id");

export default class Top100 extends LightningElement {
  @api recordId;
  @api objectApiName;
  @api userId;
  @track value = ["Option1"];
  userId = Id;
  recordId = rid;

  @wire(getMktUsers, { usrId: "$userId" }) MktUsers;
  @wire(getCommissions, { rid: "$recordId" }) selectedVals;

  objectApiName = "lda_Opportunity__c";

  get comms() {
    return [{ label: "Ross", value: "Option1" }, { label: "Rachel", value: "Option2" }];
  }

  get selectedValues() {
    return this.value.join(",");
  }

  handleChange(e) {
    this.value = e.detail.value;
  }
}
Apex file:
public with sharing class Top100 {
    @AuraEnabled(cacheable=true)
    public static List<Account> getMktUsers(Id usrId) {
        User ThisUser = [SELECT Id, Name, Office__c FROM User WHERE Id = :usrId LIMIT 1];
        List<User> MarketUsers = [SELECT Id FROM User WHERE Office__c = :ThisUser.Office__c and IsActive = True];
        //Users have matching Person accounts because some opportunities involve external sales people.
        return [SELECT Id, Name, FirstName, LastName FROM Account WHERE UserLookup__c IN :MarketUsers];
    }

    @AuraEnabled(cacheable=true)
    public static List<String> getCommissions(Id rid){
        List<String> values = new List<String>();
        for (lda_Commission__c comm : [SELECT Agent__c, Agent__r.Name FROM lda_Commission__c WHERE DealId__c = :rid]){
            values.add(comm.Agent__c);
        }
        System.debug('Values: ' + values);
        return values;
    }
}
1) How do I take the results of my Apex function and format it for the checkbox group options parameter?
2) How do I take the results of my getCommissions Apex function and format it for the checkbox group value parameter?



 
I'm trying to display the list of acitve users in the same branch office as the logged in user in a LWC.
I have an apex class that looks like this:
@AuraEnabled(cacheable=true)
    public static List<User> getMktUsers(String usrId) {
        User ThisUser = [SELECT Id, Name, Office__c FROM User WHERE Id = :usrId LIMIT 1];
        return [SELECT Id, Name FROM User WHERE Office__c = :ThisUser.Office__c and IsActive = True];
    }
I have refer to it in my LWC js file like this:
import { LightningElement, api, track, wire } from "lwc";
import getMktUsers from "@salesforce/apex/Top100.getMktUsers";
import Id from "@salesforce/user/Id";

export default class Top100 extends LightningElement {
  @wire(getMktUsers, { usrId: { Id } }) wiredUsers;
}
I call it in my html file like this:
<ul class="slds-list_ordered">
            <template for:each={wiredUsers.data} for:item="wuser">
                <li key={wuser.Id}>
                    {wuser.Name}
                </li>
            </template>
        </ul>
I'm able to get lists of users to appear if I hard code the office name, but when I try to pass in the Id to determie the current user's office, i get nothing appearing. I do not know how to debug this. Can anyone help?
 
I'm trying to rewrite some older visualforce pages that will work for both my lightning and classic users. I'd prefer using LWC since it is the recommended approach to new projects and much less complicated. However it does not work with Lightning out. Now that LWC is open-sourced, could I write an opensource LWC component and present it on both a lighting record page for lightning users as well as a VF page for classic users?
I have a flow called from a VFP that needs to utilize the Upload Files component in the flow. Since this component only works if the flow runs in Lightning Runtime, this has been enabled in our org. It turns out though, that any flow called from a VFP will by default render in Classic, EVEN IF Lightning Runtime is enabled.

I followed the directions in this document (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_lightningruntime.htm) to create a Lightning Component extending Lightning Out with a dependency on lighting:flow. Then I updated the VFP to call this component and launch the flow. 

This did result in the flow seemingly to run in Lightning Runtime vs Classic (at least visually it did). Unfortunately, the upload file component still does not work, even with this solution in place. 

Does anyone have any idea how I can get this file upload component to function to work when called from a VFP in Lightning Runtime? I'm stumped. 

Code as its implemented now is below - I haven't set any of the finish behavior or outputs yet. 
<aura:application access="global" extends="ltng:outApp" >
    <aura:dependency resource="lightning:flow"/>
</aura:application>
<apex:page standardController="Stipulations__c" recordSetVar="stipulations">
   <html>
      <head>
         <apex:includeLightning />
      </head>
      <body class="slds-scope">
         <div id="flowContainer" />
         <script>
             var statusChange = function (event) {
               if(event.getParam("status") === "FINISHED") {
                  // Control what happens when the interview finishes
 
                  var outputVariables = event.getParam("outputVariables");
                  var key;
                  for(key in outputVariables) {
                     if(outputVariables[key].name === "myOutput") {
                        // Do something with an output variable
                     }
                  }
               }
            };            $Lightning.use("c:LightningRuntime", function() {
               // Create the flow component and set the onstatuschange attribute
               $Lightning.createComponent("lightning:flow", {"onstatuschange":statusChange},
                  "flowContainer",
                  function (component) {
                     // Set the input variables
                     var inputVariables = [
                        {
                           name : 'inputOpptyId',
                           type : 'String',
                           value : "{!$CurrentPage.parameters.Id}"
                        }
                     ];
                     
                     // Start an interview in the flowContainer div, and 
                     // initializes the input variables.
                     component.startFlow("Stipulations_Submit_Documentation", inputVariables);
                  }
               );
            });
         </script>
      </body>
   </html>
</apex:page>


 
I used to use the Eclipse Force IDE and I'm switching to VSCode/SFDX. When creating a project in Force IDE, you could specify retreiving "Apex, Lightning, and Visualforce (classes, triggers, test suites, LIghtinging component bundles, pages, Visualforce comonents, and static resources)" 
It appears the -m option of sfdx force:sourc:retrieve could alow for grabbing these same items, but what -m options do I specify? What options are necessary to retrieve new development items (Aura, LWC, etc)?
Hello, when doing the 
Get Started with Salesforce DX 
Quick Start: Salesforce DX 
Create and Test Our Scratch Org

I get the ERROR:  ts_types_1.definiteEntriesOf is not a function.
I have Dev hub enabled, and followed all ths steps.
I am running the 
sfdx force:org:create -s -f config\project-scratch-def.json -a dreamhouse-org

Has anyone encountered this error before and the error message is not exactly clear on what could be the issue.
I want to send an email and create a new record for a custom object, lda_Request__c. If there is an attachment on the email, i want it to be associated with the new record. The code below is 100% covered and tests appear to create the ContentVersion object, but when I send a real email with a real attachment, the new record is created, but there is no sign of the new ContentVersion record nor the ContentDocumentLink record and I get no errors. Can anyone please help?
 
global class ResearchRequestByEmail implements Messaging.InboundEmailHandler {
 
    global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, Messaging.InboundEnvelope env){
        
        // Create an InboundEmailResult object for returning the result of the Apex Email Service
        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
        
        String PTSubject = '';
        PTSubject = email.subject;
        string myHTMLBody = '';
        myHTMLBody = email.htmlBody;
        
        // Get User Id
        User Apprvr = [SELECT Id, Name FROM User WHERE Email = :email.fromAddress LIMIT 1];
        
        // Create new Request
        lda_Request__c request = new lda_Request__c();
        request.Approver__c = Apprvr.Id;
        request.Request_Subject__c = PTSubject;
        request.Request_Details__c = myHTMLBody;
        request.Via_Email__c = True;
        request.Status__c = 'New';
        request.Property_Description_Method__c = 'Via Email';
        insert request;

        // Attachments using Content Version
        if (email.binaryAttachments != null){
            for (Messaging.InboundEmail.binaryAttachment binAttach :email.binaryAttachments){
                ContentVersion cv = new ContentVersion();
                cv.VersionData = binAttach.body;
                cv.Title = binAttach.fileName;
                cv.PathOnClient = binAttach.fileName;
                //cv.FirstPublishLocationId = request.Id;
                insert cv;
                
                cv = [select ContentDocumentId from ContentVersion where id = :cv.id limit 1];

                ContentDocumentLink cdl = new ContentDocumentLink();
                cdl.LinkedEntityId = request.Id;
                cdl.ContentDocumentId = cv.ContentDocumentId;
                cdl.ShareType = 'V';
                insert cdl;
            }
        }
        result.success = true;
        
        // Return the result for the Apex Email Service
        return result;
    }
}