This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import necessary libraries | |
var express = require('express'); // Express.js for building the server | |
var bodyParser = require('body-parser'); // Body-parser for parsing the request body | |
var cors = require('cors'); // CORS for handling cross-origin requests | |
// Import the Google Cloud client library | |
const {PubSub} = require('@google-cloud/pubsub'); // Google Cloud Pub/Sub for real-time messaging | |
// Initialize Express.js | |
var app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Thank You</title> | |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet"> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Contact form</title> | |
<!-- Include Font Awesome CSS for icons --> | |
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous"> | |
<!-- Include Google Fonts (Roboto) for styling --> | |
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- This Lightning Component Bundle is configured to be exposed on the Home Page. --> | |
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | |
<apiVersion>58.0</apiVersion> | |
<isExposed>true</isExposed> | |
<targets> | |
<target>lightning__HomePage</target> | |
</targets> | |
</LightningComponentBundle> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import necessary modules from the Lightning Web Components (LWC) and Apex | |
import { LightningElement, wire, track } from 'lwc'; | |
import getObjectMethod from '@salesforce/apex/getObjects.getObjectMethod'; | |
// Define the PolymorphicRecordPicker class | |
export default class PolymorphicRecordPicker extends LightningElement { | |
// Track the target objects, selected target, current selected record ID, and loading state | |
@track targetObjects = [ | |
{ label: 'Account', value: 'Account' }, | |
{ label: 'Contact', value: 'Contact' }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@isTest | |
public class getObjectsTest { | |
@isTest static void testGetObjectMethod() { | |
// Call the method to test | |
List<String> result = getObjects.getObjectMethod(); | |
System.assertNotEquals(null, result, 'The returned list should not be null'); | |
System.assert(result.size() > 0, 'The returned list should not be empty'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class getObjects { | |
// The @AuraEnabled annotation makes the method accessible from Lightning component | |
@AuraEnabled(cacheable=true) | |
public static List<String> getObjectMethod() { | |
// Initialize a list to hold the names of all accessible, createable, and updateable custom objects | |
List<String> customObjectNames = new List<String>(); | |
// Loop through all sObject types in the org | |
for(Schema.SObjectType objType : Schema.getGlobalDescribe().Values()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Container with relative positioning */ | |
.loading-container { | |
position: relative; | |
display: inline-block; | |
} | |
/* Spinner container with absolute positioning and centered content */ | |
.spinner-container { | |
position: absolute; | |
top: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<!-- Main container --> | |
<div class="loading-container"> | |
<!-- Loading spinner shown when isLoading is true --> | |
<template if:true={isLoading}> | |
<div class="spinner-container"> | |
<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> | |
</div> | |
</template> | |
<!-- Lightning card for the dynamic record picker --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- This Lightning Component Bundle is configured to be exposed on the Home Page. --> | |
<LightningComponentBundle xmlns="<http://soap.sforce.com/2006/04/metadata>"> | |
<apiVersion>58.0</apiVersion> | |
<isExposed>true</isExposed> | |
<targets> | |
<target>lightning__HomePage</target> | |
</targets> | |
</LightningComponentBundle> |