Skip to content

Commit

Permalink
Merge pull request #1 from sahanhe-test/fixSFSampleIssues
Browse files Browse the repository at this point in the history
Fix sf sample issues
  • Loading branch information
anupama-pathirage authored Jan 19, 2024
2 parents 5ba6b85 + 5885de8 commit 867a528
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 8 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,21 @@ salesforce:Client salesforce = check new ({
token: salesforceAccessToken
}
});

mysql:Client mysql = check new (host, user, password, database, port);

public function main() returns error? {
stream<ProductRecieved, error?> streamOutput = mysql->query(
`SELECT name, unitType, currencyISO, productId FROM products WHERE processed = false`);
ProductRecieved[] productsRecieved = check from ProductRecieved items in streamOutput
select items;
foreach ProductRecieved prductRecieved in productsRecieved {
record {|ProductRecieved value;|}|error? productRecieved = streamOutput.next();
while productRecieved !is error|() {
Product product = {
Name: prductRecieved.name,
Product_Unit__c: prductRecieved.unitType,
CurrencyIsoCode: prductRecieved.currencyISO
Name: productRecieved.value.name,
Product_Unit__c: productRecieved.value.unitType,
CurrencyIsoCode: productRecieved.value.currencyISO
};
_ = check salesforce->create("Product2", product);
_ = check mysql->execute(
`UPDATE products SET processed = true WHERE productId = ${prductRecieved.productId}`);
`UPDATE products SET processed = true WHERE productId = ${productRecieved.value.productId}`);
productRecieved = streamOutput.next();
}
}
File renamed without changes.
File renamed without changes.

0 comments on commit 867a528

Please sign in to comment.