I have the following solidity code, to get the data that has been mapped to an address,
function showOrg(address org) external view returns(uint identifier, string memory organization_name, bool ActivityStatus, string memory Classifier, string memory Address, string memory DomiciledIn, bool Status){
require(orgs[org].admins[msg.sender] == true, "You are not authorized to view this data!");
return(orgs[org].identifier, orgs[org].organization_name, orgs[org].ActivityStatus, orgs[org].Classifier, orgs[org].Address, orgs[org].DomiciledIn, orgs[org].Status);
}
I am calling it from Web3 as follows,
AMLContract.methods.showOrg('0xCe37A39e3EaB674572EDd4b37f33841774750b2F')
.send({from: contractAddress}).then(function(receipt){
console.log(receipt)
});
However, it does not seem to return the data that I am expecting, which is the 'organization_name' and so on. How can I get this data or is there something wrong with my approach here?
What I get is something like this,
{transactionHash: "0x5abceb4c507779b7d9ed89294358389174f4a1b6e254e14b7745dc480b48aaba", transactionIndex: 0, blockHash: "0xd40bbe210fd94ff79bcd7e7e14ce28612a00ab40fa420c40dd2ed5515d195ac1", blockNumber: 44, from: "0xf7642c725fa20c2ff18befbf7351b5fb94077ef9", …}
What am I doing wrong? As additional information, given below is my Solidity function for adding data,
function addOrg(address org, uint _identifier, string calldata _organization_name, bool _ActivityStatus, string calldata _Classifier, string calldata _Address, string calldata _DomiciledIn, bool _Status) external{
Org storage organization = orgs[org];
organization.identifier = _identifier;
organization.organization_name = _organization_name;
organization.ActivityStatus = _ActivityStatus;
organization.Classifier = _Classifier;
organization.Address = _Address;
organization.DomiciledIn = _DomiciledIn;
organization.Status = _Status;
organization.admins[msg.sender] = true;
}