• Vladimir Bessonov
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 26
    Questions
  • 20
    Replies

I am trying to move from org development to source code development. 
i cannot find clear instructions on how to work with metadata. 

for example I declaratively created customapplication, objects, tabs, each object has page layout, custom field, etc. 
How to import it into my source code and update package.xml now? Import with all dependent fields, objects, etc?

if I import some custom object and try to push code, it fails as some relevant objects, fields are missing. 

I have no issue with Sfdx-project-cicd, but I don't understand how to import metadata with relevant objects, fields. 

Please some one show how to do with examples, not general phrases 



 

I have an issue with API versions

when I run locally "lwc-jest" I have not issue. API 50 

 PASS  force-app/main/default/lwc/hello/__tests__/hello.test.js
  c-hello
    ✓ displays greeting (18ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        1.86s, estimated 2s

But when I push the code to git, I receive the message that version 47 is required and pipeline fails. 
"error Invalid sourceApiVersion found in sfdx-project.json. Expected 47.0, found 50.0"

Can some explain, please?

sfdx-project.json is below 
{
"packageDirectories": [
{
"path": "force-app",
"default": true,
"package": "CoManagerApp",
"versionName": "Version 1.0",
"versionNumber": "1.0.0.NEXT"
}
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "50.0",
"packageAliases": {
"CoManagerApp": "xxxxxxxxxxxxxx"
}
}


package.json 
"scripts": {
"test:lwc": "sfdx-lwc-jest",
"test:scratch": "sfdx force:apex:test:run --codecoverage --resultformat human --wait 10"
},
"devDependencies": {
"@salesforce/sfdx-lwc-jest": "^0.10.1"
}
}
Hi. How to fix this issue? 

when I try to deploy with api 48 - I recevie the following:
XXX_Record_Page.flexipage-meta.xml Property 'itemInstances' not valid in version 48.0 (3:23) 
If I comment out  'itemInstances', then I get error about <componentInstanceProperties> 

Hi. I use the CICD template for my project.

Despite all this nice story about source driving dev, we need to create metadata in some sandbox firsrt, right? 

I used sfdx-project-cicd template. then I open my sandbox, declaratively create app/tabs, etc. After that I retrieve it with sfdx force:source:retrieve -u DevHub -m options. 

My package.xml in template included any possible metadata (wildcards).
How I can update my local package.xml that only included my local metadata ?

I don't want to do it manually. it will bring some errors eventually. 

Hi. I am new to Salesforce dev. 
I am confused about how to work with metadata and what is it exactly. 

I set up a pipeline with sfdx-project-cicd from salesforce. 
After I create and pushed 1 package I need to start creating metadata. 
when I used scratch org I was just pulling it from sandbox that was a copy of my production env for example. I was receiving lots of data that I don't need at all. 

After I deployed my GitLabPackage to sandbox I went to this sandbox and created App, Tabs. 

How do I get those App and Tabs? If I use pull I will get all the metadate from scratch org, and I don't need it. After pull I tried to do push and then I got lots of issues. I could not deploy what I pulled to Sandbox anymore. Errors related to some other objects, permissions, etc. 

I cannot figure out how to retreive the data with sfdx force:source:retrieve. What flags to add to retrieve App and Tabs? 

Can some one guide me throgh? 
how to assign Metadata to packages and how to retrieve it? 

 
I created unlocked package in gitlab using the template. It is cool. but now how can I continue with development? 

It is clear how to create and add LWC. 
I need to create Lighting App/Tabs/ Custom Objects. 

When I was using Sandbox and sdfx project - I could create declaratively App/Tabs/ Custom Objects and then use "git pull" command to get them in my source code. 

I understand that I still can create  App/Tabs etc in slected Sandbox (configured with VARs in gitlab). I dont have it clear how to push to production it later, even classes and triggers work in sandbox. 

in Salesforce presentation they import somehow "metadata". 
 
Hi. I recently learned about CICD in Salesforce. It looks cool when you use a template for demonstration purposes 
Next question, how can I program objects, tabs, etc declarative way? 
Before I could set up tabs, app, path, other objects in a scratch org, and pull it. 
How I have to do when I am in CICD,100 % source code? 
To me, it is not yet clear. 

 
Hi. I am trying to use the template to set dev environment using template sfdx-project-template.

I did not get it from Salesforce presentation. 
nether clear it from documentation 
I set only DEVHUB_AUTH_URL and 
SANDBOX_AUTH_URL

Actually, I thought I have to give  DEVHUB_AUTH_URL - the rest would be set automatically. Am I right? 

It is safe to set a production environment with DEVHUB_AUTH_URL? 

based on what I thought first scratch org will be created and it will be possible to test the new feature, changes
I am using a template from GitLab 
sfdx-project-template

When I try push my first commit I get the message Project `sfdx/sfdx-cicd-template` not found or access denied! and pipeline failed. 
How to proceed? 

It might be wrong VARs.

it is another question 


DEVHUB_AUTH_URL - I set to Sfdx Auth Url 

SANDBOX_AUTH_URL - the same for sandbox. 

from presentation, it is not clear at all how to set the vars  
I am using code from iOS13Native. 
when Use Apex and do the same query I receive workspaces from office (office - workspace are parent - detail) 

but the same code iOS SDK does not return any workspaces. 

let request = RestClient.shared.request(forQuery: "SELECT id, Name, WorkSpaceID__c FROM WorkSpace__c WHERE Office__c = '\(offi.id)'", apiVersion: nil)
the code I used is copy-paste from  ContactsForAccount in this example.

I can get offices like Accounts, but when I try to get workspaces I receive nothing and no error.

// import Foundation import SalesforceSDKCore import Combine struct WorkSpace : Hashable, Identifiable, Decodable { let id: String let Name: String? let Office: String? } struct WorkSpaceResponse: Decodable { var totalSize: Int var done: Bool var records: [WorkSpace] } class WorkSpaceForOfficeModel: ObservableObject { @Published var workspaces: [WorkSpace] = [] var office: Office? private var workspacesCancellable: AnyCancellable? func fetchWorkSpacesForOffice(){ guard let offi = self.office else {return} print("office id in query \(offi.id)") let request = RestClient.shared.request(forQuery: "SELECT id, Name, WorkSpaceID__c FROM WorkSpace__c WHERE Office__c = '\(offi.id)'", apiVersion: nil) workspacesCancellable = RestClient.shared.publisher(for: request) .receive(on: RunLoop.main) .tryMap({ (response) -> Data in print("mapping data") return response.asData() }) .decode(type: WorkSpaceResponse.self, decoder: JSONDecoder()) .map({ (record) -> [WorkSpace] in record.records }) .catch( { error in Just([]) }) .assign(to: \.workspaces, on:self) } }
After some time in console I see 
Received memory pressure event 2 vm pressure 0 2020-10-07 17:25:35.477711-0700 iOS13NativeSwiftTemplate[27097:10283468] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service 2020-10-07 17:25:35.481420-0700 iOS13NativeSwiftTemplate[27097:10283468] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service
How it is supposed to work? 

Async call 
self.viewModel.fetchWorkSpacesForOffice()
then when @ObservedObject is changed UI shall be updated? 
@ObservedObject var viewModel = WorkSpaceForOfficeModel()
My usersyncs is below
as I understand from Docu if workspace is detail of Office (line contact is detail of Account in template ) I dont need to create soup for workspaces. I can get them with sql query to offline data. Is it? 
{ "syncs": [ { "syncName": "syncDownAccounts", "syncType": "syncDown", "soupName": "Account", "target": {"type": "soql", "query":"SELECT Id, Name, Industry FROM Account LIMIT 25"}, "options": {"fieldlist":["Id", "Name", "Industry", "LastModifiedDate"], "mergeMode":"LEAVE_IF_CHANGED"} }, { "syncName": "syncDownOffices", "syncType": "syncDown", "soupName": "Office", "target": {"type": "soql", "query":"SELECT Id, OfficeID__c, GPS__c, Name FROM Office__c LIMIT 20"}, "options": {"fieldlist":[ "OfficeID__c","GPS__c", "Name", "LastModifiedDate"], "mergeMode":"LEAVE_IF_CHANGED"} } ] }


 
HI. I cannot find examples of how to use userstore and usersync 
I am trying to build iOS project
I added my configs 

 
{
  "soups": [
    {
      "soupName": "Account",
      "indexes": [
        { "path": "Id", "type": "string"},
        { "path": "Name", "type": "string"},
        { "path": "Industry", "type": "string"},
        { "path": "__local__", "type": "string"}
      ]
    },
    {
      "soupName": "Office",
      "indexes": [
        { "path": "Id", "type": "string"},
        { "path": "Name", "type": "string"},
      ]
    }
    
  ]
}
 
{
  "syncs": [
    {
      "syncName": "syncDownAccounts",
      "syncType": "syncDown",
      "soupName": "Account",
      "target": {"type": "soql", "query":"SELECT Id, Name, Industry FROM Account LIMIT 25"},
      "options": {"fieldlist":["Id", "Name", "Industry", "LastModifiedDate"], "mergeMode":"LEAVE_IF_CHANGED"}
    },
    {
      "syncName": "syncDownOffices",
      "syncType": "syncDown",
      "soupName": "Office",
      "target": {"type": "soql", "query":"SELECT Id, Name FROM Account LIMIT 25"},
      "options": {"fieldlist":["Id", "Name", "Industry"], "mergeMode":"LEAVE_IF_CHANGED"}
    }
    
  ]
}
My Model.swift is copy paste from example project iOSNative, but it does not work
import Combine
import SmartStore
import MobileSync
import CoreLocation

/**
 Model object for an office
 */
struct Office: Hashable, Identifiable, Decodable {
    let id: String
    let name: String
//    var coordinates: Coordinates
//
//    var locationCoordinate: CLLocationCoordinate2D {
//        CLLocationCoordinate2D(
//            latitude: coordinates.latitude,
//            longitude: coordinates.longitude)
//    }
}

/**
 ViewModel for Account List
 */
class OfficeListModel: ObservableObject {
    
    @Published var offices: [Office] = []
    
    var store: SmartStore?
    var syncManager: SyncManager?
    private var syncTaskCancellable: AnyCancellable?
    private var storeTaskCancellable: AnyCancellable?
    
    init() {
        store = SmartStore.shared(withName: SmartStore.defaultStoreName)
        syncManager = SyncManager.sharedInstance(store: store!)
    }
    
    func fetchOffices() {
        syncTaskCancellable = syncManager?.publisher(for: "syncDownOffices")
            .receive(on: RunLoop.main)
            .sink(receiveCompletion: { _ in }, receiveValue: { _ in
                self.loadOfficeFromSmartStore()
        })
        self.loadOfficeFromSmartStore()
    }
    
    private func loadOfficeFromSmartStore() {
         storeTaskCancellable = self.store?.publisher(for: "select {Office__c:Name}, {Office__c:Id}, {Office__c:LastModifiedDate} from {Office__c}")
            .receive(on: RunLoop.main)
            .tryMap {
                $0.map { (row) -> Office in
                    let r = row as! [String?]
                    return Office(id: r[1] ?? "", name: r[0] ?? "" )
                }
            }
            .catch { error -> Just<[Office]> in
                print(error)
                return Just([Office]())
            }
            .assign(to: \OfficeListModel.offices, on:self)
    }
    
}

struct Coordinates: Hashable, Codable {
    var latitude: Double
    var longitude: Double
}

Error I get
020-10-03 23:46:06.332646-0700 iOS13NativeSwiftTemplate[6701:459960] [MobileSync] CLASS: SFSyncDownTask runSync failed:{
  "soupName" : "Office",
  "options" : {
    "fieldlist" : [
      "Id",
      "Name",
      "LastModifiedDate"
    ],
    "mergeMode" : "LEAVE_IF_CHANGED"
  },
  "error" : "{\n    error =     (\n                {\n            errorCode = \"MALFORMED_QUERY\";\n            message = \"\\nselect LastModifiedDate,Id, Name, from Office__c order by LastModifiedDate\\n                                 ^\\nERROR at Row:1:Column:34\\nunexpected token: 'from'\";\n        }\n    );\n}",
  "_soupEntryId" : 2,
  "maxTimeStamp" : -1,
  "type" : "syncDown",
  "progress" : 0,
  "endTime" : 1601793936278,
  "target" : {
    "idFieldName" : "Id",
    "modificationDateFieldName" : "LastModifiedDate",
    "iOSImpl" : "SFSoqlSyncDownTarget",
    "type" : "soql",
    "query" : "select LastModifiedDate,Id, Name, from Office__c order by LastModifiedDate"
  },
  "totalSize" : -1,
  "startTime" : 1601793965564,
  "status" : "RUNNING",
  "name" : "syncDownOffices"
} cause:Server call for sync down failed errorError Domain=com.salesforce.RestAPI.ErrorDomain Code=400 "(null)" UserInfo={error=(
        {
        errorCode = "MALFORMED_QUERY";
        message = "\nselect LastModifiedDate,Id, Name, from Office__c order by LastModifiedDate\n                                 ^\nERROR at Row:1:Column:34\nunexpected token: 'from'";
    }
)}

 
I am trying to write my own app using iosnative template
When I query Account, everything works fine,
I created my own object Office__c. 

when I replace Account for Office__c - they have the same field. Name and ID - it is not working 

Where I can find detailed examples? I was trying to read docu for ios sdk. no luck. 
func fetchOffices() {
        syncTaskCancellable = syncManager?.publisher(for: "syncDownOffices")
            .receive(on: RunLoop.main)
            .sink(receiveCompletion: { _ in }, receiveValue: { _ in
                self.loadOfficeFromSmartStore()
        })
        self.loadOfficeFromSmartStore()
    }
    
    private func loadOfficeFromSmartStore() {
         storeTaskCancellable = self.store?.publisher(for: "select {Account:Name}, {Account:Id} from {Account}")



 
Hello.
can somebody advise how to structure data for booking?

For example, I want to use salesforce as a backend for storing data about the object - we have an office with tables and office space is limited, so all employees when they want to come to the office, first have to reserve a table ( select the date and time they want to reserve a particular table for themselves or others)

how to do it in salesforce? 

I will use iOS SDK as the client, maybe later I will add visualforce component for web-version.

Please advise. 
 
Hi. I have the following code. 
It works when I update the status of part - the code below updates the dates when the status was changed. 
It has a Recursion constant that prevents Apex code run forever. It works every time the status of part is updated. It works just fine. 

After the dates of each part are updated and component status is updated, I call the same static method from the class below (own trigger for Truck__c)  but Recursion is still True and the code is not executed. 

Can someone explain why is so? 

I
public with sharing class UpdateDateOnStatusChange {
    public UpdateDateOnStatusChange() {

    }

    public static void updateDate(ID PartID, String NewStatus) {
        System.debug('UpdateDateOnStatusChange.updateDate is called: ID, Status' + PartID + ' ' + NewStatus);
        System.debug(Recursion.quoteRecursion);
        if(Recursion.quoteRecursion)
        return;
      Recursion.quoteRecursion = true;
            
        Schema.SObjectType PartType = PartID.getSObjectType();
       // String ListPartType = 'List<' + PartType + '>';
        System.debug(PartType); // Propulsion_Part__c or Truck_Part__c
        // date to update 
        String DateField; 
        Date UpdateDate = Date.today();

        
        SObject Part = (SObject)Type.forName(String.valueOf(PartType)).newInstance();
        String qryStringPart = 'SELECT Id, Sent_Date__c, Arrival_Date__c, Acceptance_Date__c, End_of_Warranty__c FROM ' + String.valueOf(PartType) + ' WHERE ID ' + '=' + '\'' + PartID+ '\'';  
        system.debug('***********************Build Query == ' + qryStringPart);                  
        // SObject resultObject = Database.query(qryString);
        Part = Database.query(qryStringPart); // shell return 1 record only
        system.debug('Part :' + Part);
        
        switch on NewStatus {
            when 'SENT' {
                Part.put('Sent_Date__c',UpdateDate);
                Part.put('Arrival_Date__c', Null);
                Part.put('Acceptance_Date__c',Null);
                Part.put('End_of_Warranty__c',Null);
            }
            when 'ARRIVED' {
                Part.put('Arrival_Date__c', UpdateDate);
                Part.put('Acceptance_Date__c',Null);
                Part.put('End_of_Warranty__c',Null);
            }
            when 'ACCEPTED/WARRANTY' {
                Part.put('Acceptance_Date__c', UpdateDate);
                Part.put('End_of_Warranty__c',UpdateDate.addMonths(36));
            }
            when 'END OF WARRANTY' {
                Part.put('End_of_Warranty__c', UpdateDate);
            }
            
        }
        System.debug('PartID, Status, UpdateDate, Part' + PartID + ' ' + NewStatus + ' ' + UpdateDate + ' ' + Part);
        update Part;
    }
}
The recursion class is below:
 
public class Recursion {
    public static boolean quoteRecursion;
    static {
      quoteRecursion = false;
    }
  }




 
How I can cast types? 

See the code below. In comments, I mark what I need to code.
 
public class ObjectStatusUpdate {
    public ObjectStatusUpdate() {
        
    }

    public enum Status {NOT_SENT , SENT, ARRIVED, ACCEPTED, AFTERWARRANTY}
    Status ComponentState = Status.NOT_SENT;
    public void updateComponentStatus(ID PartID, String NewStatus, ID ComponentID ) {

        switch on NewStatus {
            when 'SENT' {
                ComponentState = Status.SENT;
            }
            when 'ARRIVED' {
                ComponentState = Status.ARRIVED;
            }
            when 'ACCEPTED/WARRANTY' {
                ComponentState = Status.ACCEPTED;
            }
            when 'AFTER WARRANTY' {
                ComponentState = Status.AFTERWARRANTY;
            }
            when else {
                ComponentState = Status.NOT_SENT;
            }
        }

                // Part type
                Schema.SObjectType PartType = PartID.getSObjectType();
                String ListPartType = 'List<' + PartType + '>';
                System.debug(PartType); // Propulsion_Part__c or Truck_Part__c
                // Comp type 
                Schema.SObjectType CompType = ComponentID.getSObjectType();
                String ListCompType = 'List<' + CompType + '>';
                System.debug(CompType); // Propulsion__c or Truck__c
                
                List<SObject> PartList = (List<SObject>)Type.forName(ListPartType).newInstance();
                String qryStringPartList = 'SELECT Id, Status__c FROM ' + String.valueOf(PartType) + ' WHERE ' + String.valueOf(CompType) + '=' + '\'' + ComponentID + '\'';  
                system.debug('***********************Build Query == ' + qryStringPartList);                  
                // SObject resultObject = Database.query(qryString);
                PartList = Database.query(qryStringPartList);

        if(PartList.isEmpty() ) { 
            System.debug( 'Part list of prop set shall not be empty: not normal') ; 
           return;
        }
        
        // How to cast part to <PartType>?  Here I can an error that Status__c does not exists
        for (SObject part : PartList) {

        if (part.Status__c != NewStatus && NewStatus != 'NOT SENT')
            {
                Status tempStatus;
                switch on part.Status__c {
                    when 'SENT' {
                        tempStatus = Status.SENT;
                    }
                    when 'ARRIVED' {
                        tempStatus = Status.ARRIVED;
                    }
                    when 'ACCEPTED/WARRANTY' {
                        tempStatus = Status.ACCEPTED;
                    }
                    when 'AFTER WARRANTY' {
                        tempStatus = Status.AFTERWARRANTY;
                    }
                    when else {
                        tempStatus = Status.NOT_SENT;
                    }
                }


            if (TempStatus.ordinal() < ComponentState.ordinal()) {
                ComponentState = TempStatus;
            } 

            switch on ComponentState {
                when SENT {
                    NewStatus = 'SENT';
                }
                when ARRIVED {
                    NewStatus = 'ARRIVED';
                }
                when ACCEPTED {
                    NewStatus = 'ACCEPTED/WARRANTY';
                }
                when AFTERWARRANTY {
                    NewStatus = 'AFTER WARRANTY';
                }
                when else {
                    NewStatus = 'NOT SENT';
                }
            }

// Here again I need to replace Propusion__c to CompType . How? 
            Propulsion__c ComponentToUpdate = [SELECT ID, Status__c FROM Propulsion__c WHERE ID =: ComponentID];
            ComponentToUpdate.Status__c = NewStatus;
                update ComponentToUpdate;

            return;
            } else {            
// replace Propulsion__c to PartType. How ?
Propulsion__c ComponentToUpdate = [SELECT ID, Status__c FROM Propulsion__c WHERE ID =: ComponentID];
                ComponentToUpdate.Status__c = NewStatus;
                update ComponentToUpdate; 
            }


        }
    }

}

 

I have the following code 
 
Error  force-app/main/default/classes/ObjectStatusUpdate/ObjectStatusUpdate.cls  Variable does not exist: PartList1 (35:89)
Error  force-app/main/default/classes/ObjectStatusUpdate/ObjectStatusUpdate.cls  Invalid loop variable type expected SObject was Propulsion_Part__c



I am getting the following errors
 
Error  force-app/main/default/classes/ObjectStatusUpdate/ObjectStatusUpdate.cls  Variable does not exist: PartList1 (35:89)
Error  force-app/main/default/classes/ObjectStatusUpdate/ObjectStatusUpdate.cls  Invalid loop variable type expected SObject was Propulsion_Part__c



What is wrong? Instead of hard coded Custom__c, I want it to define by ID passed or name 'Custom__c'. 

I saw this code in various places, but it doesn't work for me.
 
How I can define Type T dynamically?

see code below

public string createObject(String ProjectName, String ObjectName, ID ObjectID, CreateObjectData ObjData) {

Project project = ProjectMap.Projects.get(ProjectName);
Type T;
switch on ObjectName {
T = Type.forName('Propulsion_Part__c');
}

when 'Truck' { 
T = Type.forName('Truck_Part__c');
}
}
List<T> PartList = New List<T>(); .... 
I am getting an error 

IF( DATE(Calibration_Valid__c) >  ADDMONTHS(TODAY(),3) , "NOT CALIBRATED", "CALIBRATED")

Error: Field Calibration_Valid__c may not be used in this type of formula

Calibration_Valid__c is valid API. It is an existing field)
Hi. I create a class and trigger with the purpose to insert list of objects with master - detail relation when after master is created. 

I did it, but I store several lists in this class. it looks ugly. 

How I can separate this several objets with properties from the class? 
Is it possible just to keep them in SF database? is it good idea or it is a wrong direction? 

I was thinking to make object factory, so I might pass only the list of objects I want to create and the factory will return me the list of objects to insert. 
 
My code is below works to update the parent object status to what ever status all children have. 

How to implement the status change back if for example, someone put status ARRIVED erroneously? 

I was thinking about using enums. 
But I cannot assign the value to enums like 

public enum Status {NOT_SENT = 0 , SENT = 1, ARRIVED =2 , ACCEPTED =3 , AFTERWARRANTY =4}  
in if (part.Status_list__c != NewStatus ) I would substructed 1 went to 1 next status left

How to implement it in APEX?


public without sharing class UpdatePropSetStatus {
public UpdatePropSetStatus() {
}

public void updateSetStatus(ID PropPartID, ID PropID, String NewStatus) {

List<Propulsion_part__c> PartList = New List<Propulsion_part__c>();
PartList = [ SELECT ID, Status_list__c FROM Propulsion_part__c WHERE Propulsion__c =: PropID]; //
System.debug(PropID + ' ' + NewStatus);
if(PartList.isEmpty() ) {
System.debug( 'Part list of prop set shall not be empty: not normal') ;
return;
}
// add ENUM in case the status of part was changed back to SENT from ARRIVED for Example
for (Propulsion_part__c part : PartList)
{
if (part.Status_list__c != NewStatus )
{
System.debug( 'not all parts have the same status');// ApexPages.addMessage...
return;
} else { Propulsion__c PropSetToUpdate = [SELECT ID, Set_Status__c FROM Propulsion__c WHERE ID =: PropID];
PropSetToUpdate.Set_Status__c = NewStatus;
update PropSetToUpdate;
}

}
}
}
 
I have an issue with API versions

when I run locally "lwc-jest" I have not issue. API 50 

 PASS  force-app/main/default/lwc/hello/__tests__/hello.test.js
  c-hello
    ✓ displays greeting (18ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        1.86s, estimated 2s

But when I push the code to git, I receive the message that version 47 is required and pipeline fails. 
"error Invalid sourceApiVersion found in sfdx-project.json. Expected 47.0, found 50.0"

Can some explain, please?

sfdx-project.json is below 
{
"packageDirectories": [
{
"path": "force-app",
"default": true,
"package": "CoManagerApp",
"versionName": "Version 1.0",
"versionNumber": "1.0.0.NEXT"
}
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "50.0",
"packageAliases": {
"CoManagerApp": "xxxxxxxxxxxxxx"
}
}


package.json 
"scripts": {
"test:lwc": "sfdx-lwc-jest",
"test:scratch": "sfdx force:apex:test:run --codecoverage --resultformat human --wait 10"
},
"devDependencies": {
"@salesforce/sfdx-lwc-jest": "^0.10.1"
}
}
Hi. How to fix this issue? 

when I try to deploy with api 48 - I recevie the following:
XXX_Record_Page.flexipage-meta.xml Property 'itemInstances' not valid in version 48.0 (3:23) 
If I comment out  'itemInstances', then I get error about <componentInstanceProperties> 
Hello.
can somebody advise how to structure data for booking?

For example, I want to use salesforce as a backend for storing data about the object - we have an office with tables and office space is limited, so all employees when they want to come to the office, first have to reserve a table ( select the date and time they want to reserve a particular table for themselves or others)

how to do it in salesforce? 

I will use iOS SDK as the client, maybe later I will add visualforce component for web-version.

Please advise. 
 
Hi. I have the following code. 
It works when I update the status of part - the code below updates the dates when the status was changed. 
It has a Recursion constant that prevents Apex code run forever. It works every time the status of part is updated. It works just fine. 

After the dates of each part are updated and component status is updated, I call the same static method from the class below (own trigger for Truck__c)  but Recursion is still True and the code is not executed. 

Can someone explain why is so? 

I
public with sharing class UpdateDateOnStatusChange {
    public UpdateDateOnStatusChange() {

    }

    public static void updateDate(ID PartID, String NewStatus) {
        System.debug('UpdateDateOnStatusChange.updateDate is called: ID, Status' + PartID + ' ' + NewStatus);
        System.debug(Recursion.quoteRecursion);
        if(Recursion.quoteRecursion)
        return;
      Recursion.quoteRecursion = true;
            
        Schema.SObjectType PartType = PartID.getSObjectType();
       // String ListPartType = 'List<' + PartType + '>';
        System.debug(PartType); // Propulsion_Part__c or Truck_Part__c
        // date to update 
        String DateField; 
        Date UpdateDate = Date.today();

        
        SObject Part = (SObject)Type.forName(String.valueOf(PartType)).newInstance();
        String qryStringPart = 'SELECT Id, Sent_Date__c, Arrival_Date__c, Acceptance_Date__c, End_of_Warranty__c FROM ' + String.valueOf(PartType) + ' WHERE ID ' + '=' + '\'' + PartID+ '\'';  
        system.debug('***********************Build Query == ' + qryStringPart);                  
        // SObject resultObject = Database.query(qryString);
        Part = Database.query(qryStringPart); // shell return 1 record only
        system.debug('Part :' + Part);
        
        switch on NewStatus {
            when 'SENT' {
                Part.put('Sent_Date__c',UpdateDate);
                Part.put('Arrival_Date__c', Null);
                Part.put('Acceptance_Date__c',Null);
                Part.put('End_of_Warranty__c',Null);
            }
            when 'ARRIVED' {
                Part.put('Arrival_Date__c', UpdateDate);
                Part.put('Acceptance_Date__c',Null);
                Part.put('End_of_Warranty__c',Null);
            }
            when 'ACCEPTED/WARRANTY' {
                Part.put('Acceptance_Date__c', UpdateDate);
                Part.put('End_of_Warranty__c',UpdateDate.addMonths(36));
            }
            when 'END OF WARRANTY' {
                Part.put('End_of_Warranty__c', UpdateDate);
            }
            
        }
        System.debug('PartID, Status, UpdateDate, Part' + PartID + ' ' + NewStatus + ' ' + UpdateDate + ' ' + Part);
        update Part;
    }
}
The recursion class is below:
 
public class Recursion {
    public static boolean quoteRecursion;
    static {
      quoteRecursion = false;
    }
  }




 
How I can define Type T dynamically?

see code below

public string createObject(String ProjectName, String ObjectName, ID ObjectID, CreateObjectData ObjData) {

Project project = ProjectMap.Projects.get(ProjectName);
Type T;
switch on ObjectName {
T = Type.forName('Propulsion_Part__c');
}

when 'Truck' { 
T = Type.forName('Truck_Part__c');
}
}
List<T> PartList = New List<T>(); .... 
I am getting an error 

IF( DATE(Calibration_Valid__c) >  ADDMONTHS(TODAY(),3) , "NOT CALIBRATED", "CALIBRATED")

Error: Field Calibration_Valid__c may not be used in this type of formula

Calibration_Valid__c is valid API. It is an existing field)
Hi. I create a class and trigger with the purpose to insert list of objects with master - detail relation when after master is created. 

I did it, but I store several lists in this class. it looks ugly. 

How I can separate this several objets with properties from the class? 
Is it possible just to keep them in SF database? is it good idea or it is a wrong direction? 

I was thinking to make object factory, so I might pass only the list of objects I want to create and the factory will return me the list of objects to insert. 
 
Hello. 
I want to use Apex trigger and Apex class to add records to the record that was just inserted 

trigger CreatePropSet on Propulsion__c (after insert) {
    PropulsionSet.addPropSet();
}

PropulsionSet consists of the propulsion parts. 

in JavaScript I would create and object that I used as a template, in C/C++ - struct. What shall I use in Apex? Where to keep not changing data? in the same class PropulsionSet? 
 
Hello. How to trigger code with a button? 

I have HelloWorld trigger 

trigger CreateSparePart on Propulsion_part__c (before insert) {
    System.debug('Hello World!');
}

How to link it to the button on my lighting page? 
How to create pre-filled records in salesforce? 
for example I have an object - a system that consists of parts (the part is also a salesforce object, right).

the whole project consists of many identical systems. 

For example, I create a system 1 and I want that system 1 to include a predefined list of parts already. Later I will have only to enter serial numbers of each part and specific data for each part. 

the same for system 2, system 3, etc. 



 
Hi, 

I am using Trailblazer training modules to access and run IOS SF SDK however I am getting the below 2 errors so that my mobile client application doesn't load

Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
2020-03-24 16:04:48.820156-0400 MyTrailNativeApp[48394:2322742] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service

I double checked and all the required appliations / modules are correctly instsalled. 

Please help!
What is the easy way to retrieve all the components within a custom application and deploy to a seperate org. I used VS code but I had put every component in to the package xml file. Is there a ways that I can retrieve the full packagexml fiel of a app with all components.