MangoPay error on adding bank account to a mango user - payment

I am using the MangoPay php sdk to create a bank account for a user on mango pay, here the code
$api = new \MangoPay\MangoPayApi();
$api->Config->ClientId = 'clientid';
$api->Config->ClientPassword = 'password';
$api->Config->TemporaryFolder = 'temp/mango/';
$mango_user_id = '1234567';
$bank_account = new \MangoPay\BankAccount();
$details = new \MangoPay\BankAccountDetailsIBAN();
$details->IBAN = 'ibanbannkaccountnumber';
$details->BIC = 'CRLYFRPP';
$bank_account->OwnerName = 'Joe Blogs';
$bank_account->Details = $details;
$created_account = $api->Users->CreateBankAccount($mango_user_id,$bank_account);
and getting this error message:
ResponseException in RestTool.php line 345:
Bad request. One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.

https://docs.mangopay.com/endpoints/v2.01/bank-accounts#e41_create-an-iban-bankaccount
OwnerAddress is required
$bank_account->OwnerAddress = new \MangoPay\Address();
$bank_account->OwnerAddress->AddressLine1 = 'addressLine1';
$bank_account->OwnerAddress->City = 'city';
$bank_account->OwnerAddress->PostalCode = 'PostalCode';
$bank_account->OwnerAddress->Country = 'CountryIsoCode';

Related

Netsuite itemFulfillment search where status = picked

I'm trying to export Netsuite ItemFulfillment Records into a local database so I can import into UPS Worldship to send them. I'm able to export recently modified records, but can't figure out how to filter on the shipStatus. Can anyone help lead me in the correct direction?
What I have that exports recently modified records, but does not filter correctly on shipStatus:
require_once '/PHPToolkit/NetSuiteService.php';
$start_time = microtime(true);
$service = new NetSuiteService();
$transactionSearchBasic = new TransactionSearchBasic();
// type = itemFulfillment
$searchMultiSelectEnumField = new SearchEnumMultiSelectField();
$searchMultiSelectEnumField->operator = 'anyOf';
$searchMultiSelectEnumField->searchValue[] = '_itemFulfillment';
$transactionSearchBasic->type = $searchMultiSelectEnumField;
// lastmodified > datelastrun
$SearchDateField = new SearchDateField();
$SearchDateField->operator = "after";
$SearchDateField->searchValue = "2019-12-01T00:00:00";
$transactionSearchBasic->lastModifiedDate = $SearchDateField;
// shipStatus = picked
$SearchStringField = new SearchStringField();
$SearchStringField->operator = 'is';
$SearchStringField->searchValue = '_picked';
$transactionSearchBasic->shipStatus = $SearchStringField;
$transactionSearch = new TransactionSearch();
$transactionSearch->basic = $transactionSearchBasic;
$request = new SearchRequest();
$request->searchRecord = $transactionSearch;
$searchResponse = $service->search($request);
if (!$searchResponse->searchResult->status->isSuccess) {
echo "SEARCH ERROR";
} else {
echo "SEARCH SUCCESS, records found: " . $searchResponse->searchResult->totalRecords . PHP_EOL;
}
$end_time = microtime(true);
$execution_time = ($end_time - $start_time);
echo " Execution time of script = ".$execution_time." sec";
Not sure why _picked is not working.
Can you try using internal id of these status values.
Internal Id Text
A Picked
B Packed
C Shipped
Instead of '_picked' try using 'A'.

Core Data failing automatic lightweight migration

I'm crashing every time Core Data tries to do an automatic lightweight migration after making a new version of the model (let's call it "Model 2.6") in my app (currently using "Model 2.5").
I've been working with Core Data for a while now, and I'm well aware that any time I need model changes for a new version, I have to use "Editor --> Add Model Version", give that version a new identifier, and switch over to that using the "Current Version" popup. I'm familiar with the "The model used to open the store is incompatible with the one used to create the store" error, because I've made that mistake before. I believe I'm encountering a different problem, though getting that same error message.
After banging my head against this for most of the weekend, I'm hoping someone out there has seen this before and can offer some sage advice.
Here are my steps to trigger the issue:
Reset Simulator, nuke Derived Data, clean build and save a file
with the 2.5 format.
In Xcode, Editor --> Add Model Version...
Use that wizard to make a "Model 2.6" based on "Model 2.5"
Change the new guy's identifier to "2.6"
Do something super-simple to that new version that's totally compatible with automatic lightweight migration, like add an new entity.
Set that "Model 2.6" under the popup for Current Version
Rebuild & launch in the simulator. Crash while opening that 2.5 file I just saved.
I've managed file format updates successfully with nine different releases, and automatic lightweight migration always worked flawlessly, until now.
Differences between now and last time:
Version 2.5 of my model was the first time I set the "Tools Version" to "Automatic (Xcode 8)". All prior releases had this set to "Xcode 7.3" so this will be the first time a migration will happen from a model version already on "Automatic (Xcode 8)"
My xcdatamodeld (and therefore momd file) now lives in my shared framework instead of the host app (so I can share code/resources among extensions, tvOS, etc), though I tried undoing this change to see if it was the cause, and the error still occurs.
I'm honestly not sure. This was supposed to be a trivial hour-long task and it's turned into two days of head-scratching.
Here's the actual error logged after the call to
[_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:self.mainURL options:storeOptions error:&error]
where the storeOptions are { NSInferMappingModelAutomaticallyOption = 1; NSMigratePersistentStoresAutomaticallyOption = 1; } and for some reason there are two: one for the file .Model.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3 and another for the file Model.sqlite, presumably part of the migration process. (Code=134110 with underlying Code=134100)
2016-11-20 16:49:26.928867 Lightbow[27831:356321] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/pwr/Library/Developer/CoreSimulator/Devices/8BDBBB41-ECF6-4646-BA13-DFFD02C40A62/data/Containers/Data/Application/8AE75536-DB51-453F-AEC2-6531F6A0675A/Library/Application%20Support/Lightbow/.Model.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3 options:{
NSSQLitePragmasOption = {
"journal_mode" = "<null>";
};
} ... returned error Error Domain=NSCocoaErrorDomain Code=134100 "(null)" UserInfo={metadata={
NSPersistenceFrameworkVersion = 752;
NSStoreModelVersionHashes = {
LBAlarmTrigger = <a84c55da 7fabee63 d6f9965b 4a8408bb aaabc674 bdaff438 347e1ed4 44adb186>;
LBAliasTarget = <d1cdfcbc 1fecf252 1e5ef2e4 6faa5735 6e990645 b8a8a1a6 5db79d93 622ef7af>;
LBAppEventTrigger = <99063c81 4ffe9fec b4092be9 bda6b5cb a1cd8745 400a8a2c 6b44c3e5 abfba541>;
LBAssignment = <bf29b799 abdb6883 0831f861 bb255cf1 5300e503 971ba129 81a18a61 2955eb18>;
LBAudioReference = <0c155311 c41aff4f ebcbea65 1a6ee54a 39039c9a fdcc78e0 d5c21295 38a9069d>;
LBBundledAudioReference = <4c3a5f7b d475af0e df276979 c8ede1cb 24fd616f 7ef33a71 b7302d68 65246848>;
LBCTLightState = <a5c2a06e 72caae63 0b8af8c3 d1be96f0 177ae06e c15120d4 a360b8a0 219c5911>;
LBCollection = <f8c72dfe 0c446e24 0913fcfb f2e603bf 0b3a2d2d 742cda3d 0888d734 2fec4e42>;
LBCollectionItem = <e0a4fd81 4225db2c 5cb0c08d 643324bd 7b23d53a d98deb16 5fa23bf0 a8cdc512>;
LBFadeThroughTransition = <6a37014b c8064ad1 69422f5b d31fa09c 5d61fc01 2b5a50f7 2aadd2e6 76430357>;
LBGroup = <cee84942 402b44d9 905ddb29 84b5f86d d2514f21 e91d9e85 c56c1bd5 de32f3a8>;
LBHSBLightState = <c9926442 5ee27261 c633555a c6259ad9 616b0e23 f5593f5d c82b9f5b 377ff428>;
LBHardwareEventTrigger = <07bd5b0e f52d4701 719c29bc 3a0eed4b b6a93a6d ff596a7d 9b9f98c0 39a805ce>;
LBLight = <4cdd2589 13b20fe0 cc2fa2c6 ce23f092 d45e0bfd 2e5f1421 1be6e0ab a051b6d5>;
LBLightMaster = <95b22dc3 e73a2388 26768e66 1059d41d 40121a30 a3df95da d94649b4 2ed501e8>;
LBLightState = <5e36f926 259d7ef2 8212622c 821182b2 44ade18f 5e8d4fe5 e715f09e 4dc7156f>;
LBMediaItemReference = <28b87019 ffd085e6 944c4a0c fc822b47 68975cff a0ca1484 16888ccf ca89b407>;
LBPreset = <30fa1d52 bac80149 6fee4319 94e16614 cd0830d3 c6414bf6 d48831dc 4a4495b5>;
LBResourceIdentifier = <dedc1079 739eac97 fbc42105 4a64a53e a3ae6c17 00a48ae2 29d30369 e36a3d11>;
LBTimerTrigger = <66736edf 9f104506 e1950ac1 b57062c8 eda65031 d01392ae 51ad7d70 b3143468>;
LBTiming = <362157d7 155e430b 63149c49 5fa84a5f a26a85ee 61ed5748 2f125948 7d4bfeb0>;
LBTransition = <00c8f3a1 fd66426a d0778e83 f51fe772 ab15e7e8 981f2819 aaf10bfc 15384b22>;
LBTrigger = <42c5754c 424e6c9c fc0cf034 e40a4d9c 8fa33236 f9116baa 6c79c248 c6de45d2>;
LBXYLightState = <893ae1a2 4566602f 214572fe aa0eb10f a50e1b1f 2cb5bfff 764892ff 86a62a5b>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
"2.5"
);
NSStoreType = SQLite;
NSStoreUUID = "AD94F9C0-947C-4062-A026-253C6DA20AB6";
"_NSAutoVacuumLevel" = 2;
}, reason=The model used to open the store is incompatible with the one used to create the store} with userInfo dictionary {
metadata = {
NSPersistenceFrameworkVersion = 752;
NSStoreModelVersionHashes = {
LBAlarmTrigger = <a84c55da 7fabee63 d6f9965b 4a8408bb aaabc674 bdaff438 347e1ed4 44adb186>;
LBAliasTarget = <d1cdfcbc 1fecf252 1e5ef2e4 6faa5735 6e990645 b8a8a1a6 5db79d93 622ef7af>;
LBAppEventTrigger = <99063c81 4ffe9fec b4092be9 bda6b5cb a1cd8745 400a8a2c 6b44c3e5 abfba541>;
LBAssignment = <bf29b799 abdb6883 0831f861 bb255cf1 5300e503 971ba129 81a18a61 2955eb18>;
LBAudioReference = <0c155311 c41aff4f ebcbea65 1a6ee54a 39039c9a fdcc78e0 d5c21295 38a9069d>;
LBBundledAudioReference = <4c3a5f7b d475af0e df276979 c8ede1cb 24fd616f 7ef33a71 b7302d68 65246848>;
LBCTLightState = <a5c2a06e 72caae63 0b8af8c3 d1be96f0 177ae06e c15120d4 a360b8a0 219c5911>;
LBCollection = <f8c72dfe 0c446e24 0913fcfb f2e603bf 0b3a2d2d 742cda3d 0888d734 2fec4e42>;
LBCollectionItem = <e0a4fd81 4225db2c 5cb0c08d 643324bd 7b23d53a d98deb16 5fa23bf0 a8cdc512>;
LBFadeThroughTransition = <6a37014b c8064ad1 69422f5b d31fa09c 5d61fc01 2b5a50f7 2aadd2e6 76430357>;
LBGroup = <cee84942 402b44d9 905ddb29 84b5f86d d2514f21 e91d9e85 c56c1bd5 de32f3a8>;
LBHSBLightState = <c9926442 5ee27261 c633555a c6259ad9 616b0e23 f5593f5d c82b9f5b 377ff428>;
LBHardwareEventTrigger = <07bd5b0e f52d4701 719c29bc 3a0eed4b b6a93a6d ff596a7d 9b9f98c0 39a805ce>;
LBLight = <4cdd2589 13b20fe0 cc2fa2c6 ce23f092 d45e0bfd 2e5f1421 1be6e0ab a051b6d5>;
LBLightMaster = <95b22dc3 e73a2388 26768e66 1059d41d 40121a30 a3df95da d94649b4 2ed501e8>;
LBLightState = <5e36f926 259d7ef2 8212622c 821182b2 44ade18f 5e8d4fe5 e715f09e 4dc7156f>;
LBMediaItemReference = <28b87019 ffd085e6 944c4a0c fc822b47 68975cff a0ca1484 16888ccf ca89b407>;
LBPreset = <30fa1d52 bac80149 6fee4319 94e16614 cd0830d3 c6414bf6 d48831dc 4a4495b5>;
LBResourceIdentifier = <dedc1079 739eac97 fbc42105 4a64a53e a3ae6c17 00a48ae2 29d30369 e36a3d11>;
LBTimerTrigger = <66736edf 9f104506 e1950ac1 b57062c8 eda65031 d01392ae 51ad7d70 b3143468>;
LBTiming = <362157d7 155e430b 63149c49 5fa84a5f a26a85ee 61ed5748 2f125948 7d4bfeb0>;
LBTransition = <00c8f3a1 fd66426a d0778e83 f51fe772 ab15e7e8 981f2819 aaf10bfc 15384b22>;
LBTrigger = <42c5754c 424e6c9c fc0cf034 e40a4d9c 8fa33236 f9116baa 6c79c248 c6de45d2>;
LBXYLightState = <893ae1a2 4566602f 214572fe aa0eb10f a50e1b1f 2cb5bfff 764892ff 86a62a5b>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
"2.5"
);
NSStoreType = SQLite;
NSStoreUUID = "AD94F9C0-947C-4062-A026-253C6DA20AB6";
"_NSAutoVacuumLevel" = 2;
};
reason = "The model used to open the store is incompatible with the one used to create the store";
}
2016-11-20 16:49:27.027401 Lightbow[27831:356321] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/pwr/Library/Developer/CoreSimulator/Devices/8BDBBB41-ECF6-4646-BA13-DFFD02C40A62/data/Containers/Data/Application/8AE75536-DB51-453F-AEC2-6531F6A0675A/Library/Application%20Support/Lightbow/Model.sqlite options:{
NSInferMappingModelAutomaticallyOption = 1;
NSMigratePersistentStoresAutomaticallyOption = 1;
} ... returned error Error Domain=NSCocoaErrorDomain Code=134110 "(null)" UserInfo={NSUnderlyingError=0x6000002564a0 {Error Domain=NSCocoaErrorDomain Code=134100 "(null)" UserInfo={metadata={
NSPersistenceFrameworkVersion = 752;
NSStoreModelVersionHashes = {
LBAlarmTrigger = <a84c55da 7fabee63 d6f9965b 4a8408bb aaabc674 bdaff438 347e1ed4 44adb186>;
LBAliasTarget = <d1cdfcbc 1fecf252 1e5ef2e4 6faa5735 6e990645 b8a8a1a6 5db79d93 622ef7af>;
LBAppEventTrigger = <99063c81 4ffe9fec b4092be9 bda6b5cb a1cd8745 400a8a2c 6b44c3e5 abfba541>;
LBAssignment = <bf29b799 abdb6883 0831f861 bb255cf1 5300e503 971ba129 81a18a61 2955eb18>;
LBAudioReference = <0c155311 c41aff4f ebcbea65 1a6ee54a 39039c9a fdcc78e0 d5c21295 38a9069d>;
LBBundledAudioReference = <4c3a5f7b d475af0e df276979 c8ede1cb 24fd616f 7ef33a71 b7302d68 65246848>;
LBCTLightState = <a5c2a06e 72caae63 0b8af8c3 d1be96f0 177ae06e c15120d4 a360b8a0 219c5911>;
LBCollection = <f8c72dfe 0c446e24 0913fcfb f2e603bf 0b3a2d2d 742cda3d 0888d734 2fec4e42>;
LBCollectionItem = <e0a4fd81 4225db2c 5cb0c08d 643324bd 7b23d53a d98deb16 5fa23bf0 a8cdc512>;
LBFadeThroughTransition = <6a37014b c8064ad1 69422f5b d31fa09c 5d61fc01 2b5a50f7 2aadd2e6 76430357>;
LBGroup = <cee84942 402b44d9 905ddb29 84b5f86d d2514f21 e91d9e85 c56c1bd5 de32f3a8>;
LBHSBLightState = <c9926442 5ee27261 c633555a c6259ad9 616b0e23 f5593f5d c82b9f5b 377ff428>;
LBHardwareEventTrigger = <07bd5b0e f52d4701 719c29bc 3a0eed4b b6a93a6d ff596a7d 9b9f98c0 39a805ce>;
LBLight = <4cdd2589 13b20fe0 cc2fa2c6 ce23f092 d45e0bfd 2e5f1421 1be6e0ab a051b6d5>;
LBLightMaster = <95b22dc3 e73a2388 26768e66 1059d41d 40121a30 a3df95da d94649b4 2ed501e8>;
LBLightState = <5e36f926 259d7ef2 8212622c 821182b2 44ade18f 5e8d4fe5 e715f09e 4dc7156f>;
LBMediaItemReference = <28b87019 ffd085e6 944c4a0c fc822b47 68975cff a0ca1484 16888ccf ca89b407>;
LBPreset = <30fa1d52 bac80149 6fee4319 94e16614 cd0830d3 c6414bf6 d48831dc 4a4495b5>;
LBResourceIdentifier = <dedc1079 739eac97 fbc42105 4a64a53e a3ae6c17 00a48ae2 29d30369 e36a3d11>;
LBTimerTrigger = <66736edf 9f104506 e1950ac1 b57062c8 eda65031 d01392ae 51ad7d70 b3143468>;
LBTiming = <362157d7 155e430b 63149c49 5fa84a5f a26a85ee 61ed5748 2f125948 7d4bfeb0>;
LBTransition = <00c8f3a1 fd66426a d0778e83 f51fe772 ab15e7e8 981f2819 aaf10bfc 15384b22>;
LBTrigger = <42c5754c 424e6c9c fc0cf034 e40a4d9c 8fa33236 f9116baa 6c79c248 c6de45d2>;
LBXYLightState = <893ae1a2 4566602f 214572fe aa0eb10f a50e1b1f 2cb5bfff 764892ff 86a62a5b>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
"2.5"
);
NSStoreType = SQLite;
NSStoreUUID = "AD94F9C0-947C-4062-A026-253C6DA20AB6";
"_NSAutoVacuumLevel" = 2;
}, reason=The model used to open the store is incompatible with the one used to create the store}}, reason=Failed to open the store} with userInfo dictionary {
NSUnderlyingError = "Error Domain=NSCocoaErrorDomain Code=134100 \"(null)\" UserInfo={metadata={\n NSPersistenceFrameworkVersion = 752;\n NSStoreModelVersionHashes = {\n LBAlarmTrigger = <a84c55da 7fabee63 d6f9965b 4a8408bb aaabc674 bdaff438 347e1ed4 44adb186>;\n LBAliasTarget = <d1cdfcbc 1fecf252 1e5ef2e4 6faa5735 6e990645 b8a8a1a6 5db79d93 622ef7af>;\n LBAppEventTrigger = <99063c81 4ffe9fec b4092be9 bda6b5cb a1cd8745 400a8a2c 6b44c3e5 abfba541>;\n LBAssignment = <bf29b799 abdb6883 0831f861 bb255cf1 5300e503 971ba129 81a18a61 2955eb18>;\n LBAudioReference = <0c155311 c41aff4f ebcbea65 1a6ee54a 39039c9a fdcc78e0 d5c21295 38a9069d>;\n LBBundledAudioReference = <4c3a5f7b d475af0e df276979 c8ede1cb 24fd616f 7ef33a71 b7302d68 65246848>;\n LBCTLightState = <a5c2a06e 72caae63 0b8af8c3 d1be96f0 177ae06e c15120d4 a360b8a0 219c5911>;\n LBCollection = <f8c72dfe 0c446e24 0913fcfb f2e603bf 0b3a2d2d 742cda3d 0888d734 2fec4e42>;\n LBCollectionItem = <e0a4fd81 4225db2c 5cb0c08d 643324bd 7b23d53a d98deb16 5fa23bf0 a8cdc512>;\n LBFadeThroughTransition = <6a37014b c8064ad1 69422f5b d31fa09c 5d61fc01 2b5a50f7 2aadd2e6 76430357>;\n LBGroup = <cee84942 402b44d9 905ddb29 84b5f86d d2514f21 e91d9e85 c56c1bd5 de32f3a8>;\n LBHSBLightState = <c9926442 5ee27261 c633555a c6259ad9 616b0e23 f5593f5d c82b9f5b 377ff428>;\n LBHardwareEventTrigger = <07bd5b0e f52d4701 719c29bc 3a0eed4b b6a93a6d ff596a7d 9b9f98c0 39a805ce>;\n LBLight = <4cdd2589 13b20fe0 cc2fa2c6 ce23f092 d45e0bfd 2e5f1421 1be6e0ab a051b6d5>;\n LBLightMaster = <95b22dc3 e73a2388 26768e66 1059d41d 40121a30 a3df95da d94649b4 2ed501e8>;\n LBLightState = <5e36f926 259d7ef2 8212622c 821182b2 44ade18f 5e8d4fe5 e715f09e 4dc7156f>;\n LBMediaItemReference = <28b87019 ffd085e6 944c4a0c fc822b47 68975cff a0ca1484 16888ccf ca89b407>;\n LBPreset = <30fa1d52 bac80149 6fee4319 94e16614 cd0830d3 c6414bf6 d48831dc 4a4495b5>;\n LBResourceIdentifier = <dedc1079 739eac97 fbc42105 4a64a53e a3ae6c17 00a48ae2 29d30369 e36a3d11>;\n LBTimerTrigger = <66736edf 9f104506 e1950ac1 b57062c8 eda65031 d01392ae 51ad7d70 b3143468>;\n LBTiming = <362157d7 155e430b 63149c49 5fa84a5f a26a85ee 61ed5748 2f125948 7d4bfeb0>;\n LBTransition = <00c8f3a1 fd66426a d0778e83 f51fe772 ab15e7e8 981f2819 aaf10bfc 15384b22>;\n LBTrigger = <42c5754c 424e6c9c fc0cf034 e40a4d9c 8fa33236 f9116baa 6c79c248 c6de45d2>;\n LBXYLightState = <893ae1a2 4566602f 214572fe aa0eb10f a50e1b1f 2cb5bfff 764892ff 86a62a5b>;\n };\n NSStoreModelVersionHashesVersion = 3;\n NSStoreModelVersionIdentifiers = (\n \"2.5\"\n );\n NSStoreType = SQLite;\n NSStoreUUID = \"AD94F9C0-947C-4062-A026-253C6DA20AB6\";\n \"_NSAutoVacuumLevel\" = 2;\n}, reason=The model used to open the store is incompatible with the one used to create the store}";
reason = "Failed to open the store";
}
Am I missing something obvious when creating this new version? Any other caches or hidden files to clean out? I did notice that when creating a new Whatever.xcdatamodel, a "Discard All Changes..." in Xcode left that file around, so I'm extra careful to delete test runs and check "git status" outside Xcode.
I'm skeptical of the error message because I can switch the xcdatamodeld's "Current Version" back to 2.5, see the file open just fine, switch "Current Version" to 2.6, see it fail, and go back and forth with predictable success/failure. It's clearly able to open 2.5 documents, just somehow not when it's trying to migrate them to 2.6.

Get the object id when the object is created (Parse.com)

I would like to set the string value to the object id when I create the object below. At the moment it prints "nil". Any ideas? Thanks
var date:NSDate = currentDatePicker.date
var DOB:NSDate = DOBPicker.date
var user = PFUser.currentUser()
var report = PFObject(className:"reports")
report["name"] = nameTextField.text
report["DOB"] = DOB
report["date"] = date
report["user"] = user
report.saveInBackground()
var ojId = report.objectId
println(ojId)
saveInBackground is an asynchronous method, so it doesn't wait. The reason why the id is not set is because the entity has not been saved yet.
I think you should use saveInBackgroundWithBlock: and retrieve the object id form within the block (which is executed after the entity has been saved):
var report = PFObject(className:"reports")
report["name"] = nameTextField.text
report["DOB"] = DOB
report["date"] = date
report["user"] = user
report.saveInBackgroundWithBlock { (success, error) -> Void in
if success {
var ojId = report.objectId
println(ojId)
}
}
or maybe also save, which is performed synchronously - but do not use that from the main thread:
report.save()
var ojId = report.objectId
println(ojId)

SetStateKbArticleRequest On CRM 2011

SetStateKbArticleRequest request = new SetStateKbArticleRequest();
request.EntityId = KB_ID;
request.KbArticleState = KbArticleState.Unapproved;
request.KbArticleStatus = 2;
serv.Execute(request);
I'm migrating from crm 4 to 2011 and I am not able to find anything that replaces this feature!
Any help?
You need to use a standard SetStateRequest
SetStateRequest request = new SetStateRequest();
request.State = new OptionSetValue(2); // statecode 2 equals Unapproved
request.Status = new OptionSetValue(2); // statuscode 2 equals Unapproved
request.EntityMoniker = new EntityReference("kbarticle", KB_ID);
SetStateResponse response = (SetStateResponse)serv.Execute(request);
The SetStateKbArticleRequest was replaced by SetStateRequest. See http://msdn.microsoft.com/en-us/library/gg309493.aspx

Not able to fetch comments from SharePoint user profile social database

I want to fetch comments entered using SocialCommentControl from user profile social database. I tried following snippet in Managed CSOM API but could not succeed. Any help will greatly appreciated.
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("domain\\useracc", "pass#word1");
ClientContext clientContext = new ClientContext("http://testsitecollection/"); clientContext.Credentials = cred;PersonProperties owner = new PeopleManager(clientContext).GetPropertiesFor("domain\\useracc");
MicrofeedManager mgr = new MicrofeedManager(clientContext);
clientContext.Load(mgr, f => f.CurrentUser);
clientContext.Load(owner);
clientContext.ExecuteQuery();
MicrofeedRetrievalOptions optn = new MicrofeedRetrievalOptions();
optn.ContentOnly = true;
optn.IncludedTypes = MicroBlogType.All;
optn.ResultSortOrder = MicrofeedSortOrder.CreatedTime;
optn.NewerThan = DateTime.Today.AddDays(-2);
ClientResult<MicrofeedThreadCollection> res = mgr.GetMyConsolidatedFeed(optn);
clientContext.ExecuteQuery();

Resources